diff --git a/docker/Dockerfile.nginx b/docker/Dockerfile.nginx index 51e08019..8a02e982 100644 --- a/docker/Dockerfile.nginx +++ b/docker/Dockerfile.nginx @@ -17,12 +17,13 @@ RUN addgroup -g 61000 doccano \ && adduser -G doccano -S doccano -u 61000 COPY --chown=doccano:doccano --from=frontend-builder /app/dist /var/www/html -COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf +COPY docker/nginx/nginx.conf.template /etc/nginx/nginx.conf.template COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf RUN chown -R doccano:doccano /var/cache/nginx \ && chmod -R g+w /var/cache/nginx \ - && chown -R doccano:doccano /media + && chown -R doccano:doccano /media \ + && chown -R doccano:doccano /etc/nginx EXPOSE 8080 diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 0391816b..10270005 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -60,9 +60,17 @@ services: context: .. dockerfile: docker/Dockerfile.nginx image: doccano_nginx:prod + command: > + /bin/sh -c + "envsubst ' + $${WORKER_PROCESSES} + '< /etc/nginx/nginx.conf.template + > /etc/nginx/nginx.conf + && nginx -g 'daemon off;'" environment: API_URL: "http://backend:8000" GOOGLE_TRACKING_ID: "" + WORKER_PROCESSES: "auto" volumes: - static_volume:/static - media:/media diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf.template similarity index 95% rename from docker/nginx/nginx.conf rename to docker/nginx/nginx.conf.template index cb16cc16..f3a7155b 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf.template @@ -1,4 +1,4 @@ -worker_processes auto; +worker_processes ${WORKER_PROCESSES}; error_log /var/log/nginx/error.log warn;