114 lines
2.3 KiB
YAML
114 lines
2.3 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
postgres:
|
|
container_name: yimaru-backend-postgres-1
|
|
image: postgres:16-alpine
|
|
ports:
|
|
- "5432:5422"
|
|
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
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./exports:/exports
|
|
|
|
pgadmin:
|
|
container_name: yimaru-pgadmin
|
|
image: dpage/pgadmin4:latest
|
|
restart: always
|
|
ports:
|
|
- "5050:80"
|
|
environment:
|
|
PGADMIN_DEFAULT_EMAIL: admin@local.dev
|
|
PGADMIN_DEFAULT_PASSWORD: admin
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
- app
|
|
volumes:
|
|
- pgadmin_data:/var/lib/pgadmin
|
|
|
|
mongo:
|
|
container_name: yimaru-mongo
|
|
image: mongo:7.0.11
|
|
restart: always
|
|
ports:
|
|
- "27021:27017"
|
|
environment:
|
|
MONGO_INITDB_ROOT_USERNAME: root
|
|
MONGO_INITDB_ROOT_PASSWORD: secret
|
|
volumes:
|
|
- mongo_data:/data/db
|
|
networks:
|
|
- app
|
|
healthcheck:
|
|
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
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
|
|
target: runner
|
|
ports:
|
|
- "${PORT}:8080"
|
|
environment:
|
|
- DB_URL=postgresql://root:secret@postgres:5432/gh?sslmode=disable
|
|
- MONGO_URI=mongodb://root:secret@mongo:27017
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- app
|
|
command: ["/app/bin/web"]
|
|
|
|
test:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: builder
|
|
volumes:
|
|
- .:/app
|
|
command: ["tail", "-f", "/dev/null"]
|
|
networks:
|
|
- app
|
|
|
|
networks:
|
|
app:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
postgres_data:
|
|
mongo_data:
|
|
pgadmin_data:
|