[fix] docker deploy
This commit is contained in:
@@ -1,3 +1 @@
|
||||
# Folders
|
||||
venv/
|
||||
__pycache__/
|
||||
Dockerfile
|
||||
|
||||
+23
-12
@@ -21,12 +21,12 @@ services:
|
||||
backend:
|
||||
build: ./backend
|
||||
container_name: backend
|
||||
volumes:
|
||||
- media_volume:/app/project/media/
|
||||
- static_volume:/app/project/static/
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
expose:
|
||||
- 8000
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||
@@ -38,18 +38,28 @@ services:
|
||||
DJANGO_DEBUG: ${DJANGO_DEBUG:-false}
|
||||
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS:-*}
|
||||
DJANGO_INTERNAL_IPS: ${DJANGO_INTERNAL_IPS:-127.0.0.1}
|
||||
command: ["sh", "-c", "cd project && python manage.py migrate && gunicorn config.wsgi:application --bind 0.0.0.0:8080"]
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
||||
frontend:
|
||||
container_name: frontend
|
||||
expose:
|
||||
- 8080
|
||||
command:
|
||||
[
|
||||
"sh",
|
||||
"-c",
|
||||
"cd project && python manage.py collectstatic --noinput && python manage.py migrate && gunicorn config.wsgi:application --bind 0.0.0.0:8080",
|
||||
]
|
||||
|
||||
nginx:
|
||||
container_name: nginx
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3000:3000"
|
||||
restart: always
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
- media_volume:/var/html/media/
|
||||
- static_volume:/var/html/static/
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4:8.4
|
||||
@@ -68,5 +78,6 @@ services:
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
pgadmin_data:
|
||||
media_volume:
|
||||
static_volume:
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_tokens off;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://backend:8080/api/;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
}
|
||||
location / {
|
||||
root /usr/share/nginx/html/;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
location /media/ {
|
||||
root /var/html/;
|
||||
}
|
||||
location /static/ {
|
||||
root /var/html/;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user