From 7b3335d8f35483d9e720970e869a7615db388315 Mon Sep 17 00:00:00 2001 From: Rafail Gazizyanov Date: Thu, 13 Jun 2024 23:25:10 +0300 Subject: [PATCH] upd(`backend`, `deployment`): better configs now ports are exposed only at local configuration add docker watch --- .docker/compose.app.yml | 2 -- .docker/compose.db.yml | 4 ---- .docker/compose.override.yml | 38 ++++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 .docker/compose.override.yml diff --git a/.docker/compose.app.yml b/.docker/compose.app.yml index bdc7115..8e54f40 100644 --- a/.docker/compose.app.yml +++ b/.docker/compose.app.yml @@ -30,7 +30,5 @@ services: POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} POSTGRES_PORT: ${POSTGRES_PORT:-5432} POSTGRES_USER: ${POSTGRES_USER:-postgres} - ports: - - ${BACKEND_HOST_PORT:-80}:8000 networks: - backend-net diff --git a/.docker/compose.db.yml b/.docker/compose.db.yml index 1d0f4b2..c9093e0 100644 --- a/.docker/compose.db.yml +++ b/.docker/compose.db.yml @@ -27,8 +27,6 @@ services: networks: - backend-net platform: linux/amd64 - ports: - - ${POSTGRES_PORT}:5432 restart: unless-stopped volumes: - db-data:/var/lib/postgresql/data/ @@ -56,8 +54,6 @@ services: networks: - backend-net platform: linux/amd64 - ports: - - ${PGADMIN_HOST_PORT:-8080}:80 restart: unless-stopped diff --git a/.docker/compose.override.yml b/.docker/compose.override.yml new file mode 100644 index 0000000..61ef1a9 --- /dev/null +++ b/.docker/compose.override.yml @@ -0,0 +1,38 @@ +include: + - ./compose.db-env.yml + +services: + backend: + extends: + file: ./compose.app.yml + service: backend + depends_on: + - db + - pgadmin + develop: + watch: + # for only frontend container (docker compose up from project's root directory) + - action: sync + path: ./../backend/src/ + target: /app/src/ + + # for only backend container (docker compose up from backend's root directory) + - action: sync + path: ./src/ + target: /app/src/ + ports: + - ${BACKEND_HOST_PORT:-80}:8000 + + db: + extends: + file: ./compose.db.yml + service: db + ports: + - ${POSTGRES_PORT}:5432 + + pgadmin: + extends: + file: ./compose.db.yml + service: pgadmin + ports: + - ${PGADMIN_HOST_PORT:-8080}:80