From 19232e13aee19d456393e6ac7cac542b8b602c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= Date: Wed, 4 Dec 2019 21:28:59 +0100 Subject: [PATCH] Verze se statikou v nginx --- .gitlab-ci.yml | 9 ++++++--- Dockerfile.nginx | 3 +++ docker-compose.sample.yml | 30 +++++++++++------------------- docker-entrypoint.sh | 2 +- 4 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 Dockerfile.nginx diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b01417..3d904f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,8 @@ image: docker:19.03.1 variables: DOCKER_TLS_CERTDIR: "/certs" - IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + IMAGE_TAG_APP: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + IMAGE_TAG_NGINX: $CI_REGISTRY_IMAGE-nginx:$CI_COMMIT_REF_SLUG services: - docker:19.03.1-dind @@ -13,5 +14,7 @@ before_script: build: stage: build script: - - docker build -t $IMAGE_TAG . - - docker push $IMAGE_TAG + - docker build -t $IMAGE_TAG_APP . + - docker build -t $IMAGE_TAG_NGINX -f Dockerfile.nginx + - docker push $IMAGE_TAG_APP + - docker push $IMAGE_TAG_NGINX diff --git a/Dockerfile.nginx b/Dockerfile.nginx new file mode 100644 index 0000000..233eca7 --- /dev/null +++ b/Dockerfile.nginx @@ -0,0 +1,3 @@ +FROM nginx +expose 8080 +COPY nalodeni/static /opt/nalodeni-static diff --git a/docker-compose.sample.yml b/docker-compose.sample.yml index 62a8bae..b5fc4c0 100644 --- a/docker-compose.sample.yml +++ b/docker-compose.sample.yml @@ -1,21 +1,7 @@ -version: '3.4' +version: '3.6' services: - nginx: - image: nginx:latest - container_name: nalodeni-nginx - ports: - - "80:8001" - volumes: - - ./deploy/nginx:/etc/nginx/conf.d - - nalodeni_static:/static_nalodeni - depends_on: - - nalodeni - nalodeni: - image: docker-registry.pirati.cz/to/nalodeni.pirati.cz:master - container_name: nalodeni - volumes: - - nalodeni_static:/nalodeni/static_files + image: docker-registry.pirati.cz/to/nalodeni.pirati.cz:demo2 ports: - "8000" environment: @@ -41,7 +27,13 @@ services: - NALODENI_AUTH_SERVER=s-https://auth.pirati.cz/auth/realms/pirati/ - NALODENI_AUTH_CLIENT_SECRET=s-XXXXXXXXXXXXXXXXXXXX - NALODENI_EMAIL_RECIPIENT_GDPR=s-test@example.com -volumes: - nalodeni_static: - + nginx: + image: docker-registry.pirati.cz/to/nalodeni.pirati.cz-nginx:demo2 + ports: + - "8080:8080" + volumes: + - "/var/opt/docker/nginx.conf:/etc/nginx/conf.d/nalodeni.conf" + - ./deploy/nginx:/etc/nginx/conf.d + depends_on: + - nalodeni diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 762d7a9..b647e82 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -8,7 +8,7 @@ cd /nalodeni python manage.py migrate -python manage.py collectstatic --noinput --clear +#python manage.py collectstatic --noinput --clear python manage.py loaddata nalodeni_interestregion nalodeni_topics nalodeni_skills nalodeni_counties