diff --git a/docker-compose.yml b/docker-compose.yml index 520af92..a873456 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: ndd: - container_name: 'ndd-server' + container_name: 'django' build: context: . ports: @@ -11,7 +11,7 @@ services: volumes: - ./app:/ndd/app - ./log/gunicorn:/log - - ./statics:/ndd/statics + - static-data:/ndd/statics environment: - DB_HOST=db - DB_NAME=${DB_NAME} @@ -29,7 +29,7 @@ services: - db db: - container_name: 'ndd-db' + container_name: 'postgres' image: postgres:latest restart: always volumes: @@ -41,5 +41,25 @@ services: ports: - 5432:5432 + proxy: + container_name: 'nginx' + build: + context: ./proxy + restart: always + depends_on: + - ndd + ports: + - 80:80 + - 443:443 + volumes: + - /etc/letsencrypt:/etc/letsencrypt + - ./nginx/var/lib/letsencrypt:/var/lib/letsencrypt + - ./app:/ndd/app + - ./log/nginx:/log + - static-data:/ndd/statics + environment: + - TZ=Asia/Seoul + volumes: postgres-data: + static-data: diff --git a/proxy/Dockerfile b/proxy/Dockerfile index 84d051c..c013ff6 100644 --- a/proxy/Dockerfile +++ b/proxy/Dockerfile @@ -1,4 +1,4 @@ FROM nginx:latest COPY nginx.conf /etc/nginx/nginx.conf -COPY ndd.conf /etc/nginx/sites-enabled/ +COPY nddapp.duckdns.org.conf /etc/nginx/conf.d/ CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/proxy/nddapp.duckdns.org.conf b/proxy/nddapp.duckdns.org.conf index 45f965d..0dc5c8e 100644 --- a/proxy/nddapp.duckdns.org.conf +++ b/proxy/nddapp.duckdns.org.conf @@ -10,7 +10,7 @@ server { proxy_pass https://ndd-project.vercel.app/; } - location = /api { + location /api { proxy_pass http://ndd:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -18,7 +18,7 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } - location = /static { + location /static { alias /ndd/statics/; } } \ No newline at end of file