Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: docker-compose.yml #518

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 27 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
version: "3.9"
name: "biseo"
name: "biseo-test"

services:
web:
container_name: biseo-web
image: ghcr.io/sparcs-kaist/biseo-web:latest
labels:
- "com.centurylinklabs.watchtower.enable=true"
restart: always
build:
context: .
dockerfile: .docker/web.Dockerfile
ports:
- "${EXPOSE_PORT:?}:80"
environment:
Expand All @@ -16,41 +16,51 @@ services:
- api
networks:
- frontend

api:
container_name: biseo-api
image: ghcr.io/sparcs-kaist/biseo-api:latest
labels:
- "com.centurylinklabs.watchtower.enable=true"
restart: always
environment:
- NODE_ENV=production
- SERVER_PORT=8000
- DATABASE_URL=mysql://root:${DB_PASSWORD:?}@db:3306/${DB_NAME:?}
- SECRET_KEY=${SECRET_KEY:?}
build:
context: .
dockerfile: .docker/api.Dockerfile
- DATABASE_URL=mysql://root:${DB_PASSWORD}@db:3306/${DB_NAME}
- SECRET_KEY=${SECRET_KEY}
depends_on:
db:
condition: service_healthy
- db
networks:
- frontend
- backend

db:
container_name: biseo-db
restart: always
image: mysql:8.0
restart: always
environment:
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD:?}
- MYSQL_DATABASE=${DB_NAME:?}
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
- MYSQL_DATABASE=${DB_NAME}
volumes:
- biseo-data:/var/lib/mysql
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
networks:
- backend
healthcheck:
test: "mysql -uroot -p$$MYSQL_ROOT_PASSWORD $$MYSQL_DATABASE -e 'select 1'"
start_period: 0s
interval: 1s
retries: 3

watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 30
environment:
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_LABEL_ENABLE=true

volumes:
biseo-data:
external: true
Expand Down
Loading