Created
September 11, 2018 10:33
-
-
Save pashamray/80c91f3cff8c52541b6117294d72736e to your computer and use it in GitHub Desktop.
envsubst for nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
web: | |
build: nginx | |
volumes: | |
- ${SITE_DIR}:/var/www/${SITE_NAME} | |
- ./nginx/frontend.template:/etc/nginx/conf.d/frontend.template | |
- ./data/var/log/nginx:/var/log/nginx | |
- ./data/var/log/nginx/${SITE_NAME}:/var/log/nginx/${SITE_NAME} | |
- /etc/localtime:/etc/localtime:ro | |
- /etc/timezone:/etc/timezone:ro | |
environment: | |
- SITE_NAME=${SITE_NAME} | |
- FRONTEND_DIR=${FRONTEND_DIR} | |
- FRONTEND_HOST=${FRONTEND_HOST} | |
- FRONTEND_PORT=${FRONTEND_PORT} | |
command: /bin/bash -c "envsubst \"`env | awk -F = '{printf \" $$%s\", $$1}'`\" < /etc/nginx/conf.d/frontend.template > /etc/nginx/conf.d/site.conf && exec nginx -g 'daemon off;'" | |
ports: | |
- 80:80 | |
# - 443:443 | |
depends_on: | |
- php | |
networks: | |
- frontend | |
- backend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment