Added a way to template environment variables inside NGINX config using docker
* Created configuration for storing media (avatars, images, videos...)
This commit is contained in:
parent
390cffbed2
commit
88db2c2919
|
@ -26,18 +26,24 @@ services:
|
||||||
build: web/
|
build: web/
|
||||||
volumes:
|
volumes:
|
||||||
- ./web/src:/src
|
- ./web/src:/src
|
||||||
|
- ./web/media:${MEDIA_DIR}
|
||||||
environment:
|
environment:
|
||||||
- DOMAIN=${DOMAIN}
|
- DOMAIN=${DOMAIN}
|
||||||
- DB_HOST=${DB_HOST}
|
- DB_HOST=${DB_HOST}
|
||||||
- DB_NAME=${DB_NAME}
|
- DB_NAME=${DB_NAME}
|
||||||
|
- MEDIA_DIR=${MEDIA_DIR}
|
||||||
working_dir: /src
|
working_dir: /src
|
||||||
networks:
|
networks:
|
||||||
- fedilove
|
- fedilove
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
|
command: sh -c "envsubst \"`env | awk -F = '{printf \" $$%s\", $$1}'`\" < /tmp/nginx.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
|
||||||
image: nginx:latest
|
image: nginx:latest
|
||||||
volumes:
|
volumes:
|
||||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
- ./nginx.conf:/tmp/nginx.template:ro
|
||||||
|
- ./web/media:${MEDIA_DIR}:ro
|
||||||
|
environment:
|
||||||
|
- MEDIA_DIR=${MEDIA_DIR}
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:8080:80
|
- 127.0.0.1:8080:80
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
# Instance
|
# Instance
|
||||||
DOMAIN=example.org
|
DOMAIN=example.org
|
||||||
|
|
||||||
|
# Storage
|
||||||
|
# media directory inside containers
|
||||||
|
MEDIA_DIR=/data/media
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DB_HOST=db
|
DB_HOST=db
|
||||||
DB_NAME=fedilove
|
DB_NAME=fedilove
|
||||||
|
|
|
@ -3,6 +3,11 @@ server {
|
||||||
listen *:80;
|
listen *:80;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
|
# Media
|
||||||
|
location /media {
|
||||||
|
root ${MEDIA_DIR};
|
||||||
|
}
|
||||||
|
|
||||||
# Web client
|
# Web client
|
||||||
location ~ ^(/$|/@|/app) {
|
location ~ ^(/$|/@|/app) {
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
|
|
Loading…
Reference in New Issue