Yimaru-BackEnd/docker-compose.yml

55 lines
1.0 KiB
YAML

version: '3.9'
services:
postgres:
image: postgres:16-alpine
ports:
- 5422:5432
environment:
- POSTGRES_PASSWORD=secret
- POSTGRES_USER=root
- POSTGRES_DB=gh
networks:
- app
healthcheck:
test: ["CMD-SHELL", "pg_isready -U root -d gh"]
interval: 5s
timeout: 3s
retries: 5
migrate:
image: migrate/migrate
volumes:
- ./db/migrations:/migrations
depends_on:
postgres:
condition: service_healthy
command:
[
"-path",
"/migrations",
"-database",
"postgresql://root:secret@postgres:5432/gh?sslmode=disable",
"up",
]
networks:
- app
app:
build:
context: .
dockerfile: Dockerfile
ports:
- ${PORT}:8080
environment:
- DB_URL=postgresql://root:secret@postgres:5432/gh?sslmode=disable
depends_on:
migrate:
condition: service_completed_successfully
networks:
- app
command: ["/app/bin/web"]
networks:
app:
driver: bridge