Browse Source
Merge pull request #1953 from doccano/enhancement/useEnvironmentVariableInNginx
Enable to set worker processes by environment variable
pull/1954/head
Hiroki Nakayama
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
12 additions and
3 deletions
-
docker/Dockerfile.nginx
-
docker/docker-compose.prod.yml
-
docker/nginx/nginx.conf.template
|
|
@ -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 |
|
|
|
|
|
|
|
|
|
@ -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 |
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
worker_processes auto; |
|
|
|
worker_processes ${WORKER_PROCESSES}; |
|
|
|
|
|
|
|
error_log /var/log/nginx/error.log warn; |
|
|
|
|