Skip to content

Commit

Permalink
Merge pull request #518 from sparcs-kaist/517-docker-compose-update
Browse files Browse the repository at this point in the history
refactor: docker-compose.yml
  • Loading branch information
rjsdn0 authored Nov 25, 2024
2 parents dbcf6d2 + 5eaa138 commit d893b57
Showing 1 changed file with 27 additions and 17 deletions.
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

0 comments on commit d893b57

Please sign in to comment.