Skip to content

Commit

Permalink
Even more docker refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
danniel committed Mar 26, 2024
1 parent 30a9b5f commit d533f9d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 25 deletions.
44 changes: 26 additions & 18 deletions docker-compose.base.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
services:

seismic_base:
container_name: seismic_dev
backend_base:
container_name: seismic_backend_dev
env_file:
- .env
environment:
- "PYTHONUNBUFFERED=1"
restart: on-failure

seismic_dev_base:
backend_dev_base:
extends:
service: seismic_base
service: backend_base
build:
context: .
dockerfile: ./docker/dockerfiles/Dockerfile.backend.dev
Expand All @@ -25,25 +25,33 @@ services:
- "${WEBAPP_PORT:-8080}:8000"
- "${CLIENT_PORT:-3000}:3000"

db_base:
container_name: seismic_db_dev
client_base:
container_name: seismic_client_dev
env_file:
- .env
restart: always
restart: on-failure

db_base_mysql:
extends:
service: db_base
image: mysql:8.3.0
volumes:
- seismic_mysql:/var/lib/mysql
client_dev_base:
container_name: client_base
build:
context: ./
dockerfile: ./docker/dockerfiles/Dockerfile.frontend.dev
args:
- ENVIRONMENT=development
env_file:
- .env
environment:
MYSQL_DATABASE: "${DATABASE_NAME}"
MYSQL_USER: "${DATABASE_USER}"
MYSQL_PASSWORD: "${DATABASE_PASSWORD}"
MYSQL_ROOT_PASSWORD: "${DATABASE_PASSWORD}"
ENVIRONMENT: "development"
volumes:
- ./client:/code
ports:
- "${DATABASE_PORT:-3306}:3306"
- "${CLIENT_PORT:-3030}:3000"

db_base:
container_name: seismic_db_dev
env_file:
- .env
restart: always

db_base_psql:
extends:
Expand Down
11 changes: 5 additions & 6 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: seismic_multi

services:

api:
backend:
extends:
file: docker-compose.base.yml
service: seismic_base
service: backend_base
build:
context: .
dockerfile: ./docker/dockerfiles/Dockerfile.backend
Expand All @@ -19,13 +19,12 @@ services:
- db_psql

client:
container_name: seismic_client-prod
extends:
file: dk-cp.base.yml
file: docker-compose.base.yml
service: client_base
build:
context: ./client
dockerfile: ../docker/dockerfiles/Dockerfile.frontend
context: ./
dockerfile: ./docker/dockerfiles/Dockerfile.frontend
environment:
- "ENVIRONMENT=production"
ports:
Expand Down
13 changes: 12 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@ services:
webapp_psql:
extends:
file: docker-compose.base.yml
service: seismic_dev_base
service: backend_dev_base
environment:
- "DATABASE_ENGINE=postgresql"
- "DATABASE_HOST=seismic_db_dev"
- "DATABASE_PORT=5432"
depends_on:
- db_psql_dev

client_dev:
extends:
file: docker-compose.base.yml
service: client_dev_base
environment:
- "ENVIRONMENT=development"
ports:
- "${CLIENT_PORT:-3030}:3000"
depends_on:
- webapp_psql

db_psql_dev:
extends:
file: docker-compose.base.yml
Expand Down

0 comments on commit d533f9d

Please sign in to comment.