Browse Source

Enable to set worker processes by environment variable

pull/1953/head
Hironsan 2 years ago
parent
commit
497341c927
3 changed files with 12 additions and 3 deletions
  1. 5
      docker/Dockerfile.nginx
  2. 8
      docker/docker-compose.prod.yml
  3. 2
      docker/nginx/nginx.conf.template

5
docker/Dockerfile.nginx

@ -17,12 +17,13 @@ RUN addgroup -g 61000 doccano \
&& adduser -G doccano -S doccano -u 61000 && adduser -G doccano -S doccano -u 61000
COPY --chown=doccano:doccano --from=frontend-builder /app/dist /var/www/html 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 COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf
RUN chown -R doccano:doccano /var/cache/nginx \ RUN chown -R doccano:doccano /var/cache/nginx \
&& chmod -R g+w /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 EXPOSE 8080

8
docker/docker-compose.prod.yml

@ -60,9 +60,17 @@ services:
context: .. context: ..
dockerfile: docker/Dockerfile.nginx dockerfile: docker/Dockerfile.nginx
image: doccano_nginx:prod 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: environment:
API_URL: "http://backend:8000" API_URL: "http://backend:8000"
GOOGLE_TRACKING_ID: "" GOOGLE_TRACKING_ID: ""
WORKER_PROCESSES: "auto"
volumes: volumes:
- static_volume:/static - static_volume:/static
- media:/media - media:/media

docker/nginx/nginx.conf → docker/nginx/nginx.conf.template

@ -1,4 +1,4 @@
worker_processes auto;
worker_processes ${WORKER_PROCESSES};
error_log /var/log/nginx/error.log warn; error_log /var/log/nginx/error.log warn;
Loading…
Cancel
Save