Add docker-compose.prod.yaml and nginx confs

This commit is contained in:
app 2022-08-25 08:27:48 +00:00
parent 3b9498d13d
commit f960c4e779
3 changed files with 53 additions and 0 deletions

34
docker-compose.prod.yml Normal file
View File

@ -0,0 +1,34 @@
version: '3.8'
services:
web:
build:
context: ./
dockerfile: Dockerfile.prod
command: gunicorn gmba_django.wsgi:application --bind 0.0.0.0:8000
volumes:
- static_volume:/home/app/app/staticfiles
expose:
- 8000
env_file:
- ./.env.prod
depends_on:
- db
db:
image: postgres:13.0-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- ./.env.prod.db
nginx:
build: ./nginx
volumes:
- static_volume:/home/app/app/staticfiles
ports:
- 1337:80
depends_on:
- web
volumes:
postgres_data:
static_volume:

4
nginx/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM nginx:1.21-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d

15
nginx/nginx.conf Normal file
View File

@ -0,0 +1,15 @@
upstream gmba_django {
server 127.0.0.1:8000;
}
server {
listen 80;
location / {
proxy_pass http://gmba_django;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
}