Skip to content

Commit

Permalink
docker compose for dev, fixed nginx conf, added restart for containers
Browse files Browse the repository at this point in the history
  • Loading branch information
VladislavCR committed Mar 2, 2024
1 parent 6687591 commit a4e89fb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions infra/docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ services:
- POSTGRES_PASSWORD=admin

backend:
image: ${DOCKERHUB_USERNAME}/${PROJECT_NAME}_backend:latest
build: ../.
env_file: .env
ports:
- "8000:8000"
volumes:
- static_volume:/backend_static
- static_volume:/backend_static/
- ./.env:/app
depends_on:
- db

nginx:
image: ${DOCKERHUB_USERNAME}/${PROJECT_NAME}_nginx:latest
build: /nginx/.
ports:
- "80:80"
- "443:443"
volumes:
- static_volume:/static
- static_volume:/staticfiles/
- /etc/letsencrypt:/etc/letsencrypt
depends_on:
- backend
Expand Down
3 changes: 3 additions & 0 deletions infra/docker-compose-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ volumes:
services:
db:
image: postgres:latest
restart: always
env_file: .env
ports:
- "5432:5432"
Expand All @@ -16,6 +17,7 @@ services:

backend:
image: ${DOCKERHUB_USERNAME}/${PROJECT_NAME}_backend:latest
restart: always
env_file: .env
ports:
- "8000:8000"
Expand All @@ -27,6 +29,7 @@ services:

frontend:
image: ${DOCKERHUB_USERNAME_FRONT}/${PROJECT_NAME}_frontend:latest
restart: always
env_file: .env
ports:
- "3000:3000"
Expand Down
2 changes: 1 addition & 1 deletion infra/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM nginx:latest
FROM nginx:1.25
COPY nginx.conf /etc/nginx/templates/default.conf.template
7 changes: 4 additions & 3 deletions infra/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
server {
listen 80;
listen [::]:80;
server_name 89.23.117.80 devcodepet.tw1.ru 89.23.117.168 testcodepet.tw1.ru;
server_name 89.23.117.80 devcodepet.tw1.ru 89.23.117.168 testcodepet.tw1.ru localhost;

location /api/v1/ {
proxy_set_header Host $http_host;
Expand All @@ -12,7 +12,8 @@ server {
proxy_pass http://backend:8000/admin/;
}
location / {
proxy_set_header Host $http_host;
proxy_pass http://frontend:3000/;
alias /staticfiles/;
index index.html;
try_files $uri $uri/ /index.html;
}
}

0 comments on commit a4e89fb

Please sign in to comment.