Add a Nginx template using a dynamic hostname from .env

This commit is contained in:
Vincent Letourneau
2017-09-18 18:49:29 +02:00
parent 58613a90e3
commit df3560700b
5 changed files with 84 additions and 28 deletions

View File

@@ -1,15 +1,19 @@
version: '3'
services:
web:
image: nginx:latest
ports:
- "8000:80"
- "3000:443"
restart: always
image: nginx
volumes:
- "./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf"
- "./etc/ssl:/etc/ssl"
- "./web:/var/www/html"
- "./etc/nginx/default.template:/etc/nginx/conf.d/default.template"
ports:
- "8000:80"
- "3000:443"
environment:
- NGINX_HOST=${NGINX_HOST}
command: /bin/bash -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
restart: always
depends_on:
- php
- mysqldb
@@ -49,4 +53,4 @@ services:
ports:
- "8989:3306"
volumes:
- "./data/db/mysql:/var/lib/mysql"
- "./data/db/mysql:/var/lib/mysql"