Skip to content

Commit

Permalink
Merge pull request #1953 from doccano/enhancement/useEnvironmentVaria…
Browse files Browse the repository at this point in the history
…bleInNginx

Enable to set worker processes by environment variable
  • Loading branch information
Hironsan committed Aug 15, 2022
2 parents cdfa4da + 497341c commit aa3d120
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docker/Dockerfile.nginx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions docker/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
worker_processes auto;
worker_processes ${WORKER_PROCESSES};

error_log /var/log/nginx/error.log warn;

Expand Down

0 comments on commit aa3d120

Please sign in to comment.