113 lines
2.2 KiB
YAML
113 lines
2.2 KiB
YAML
version: "3.8"
|
|
|
|
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
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
|
mongo:
|
|
container_name: fortunebet-mongo
|
|
image: mongo:7.0.11
|
|
restart: always
|
|
ports:
|
|
- "27017: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
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6379:6379"
|
|
networks:
|
|
- app
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
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
|
|
- REDIS_ADDR=redis:6379
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
mongo:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- app
|
|
command: ["/app/bin/web"]
|
|
# volumes:
|
|
# - "C:/Users/User/Desktop:/host-desktop"
|
|
|
|
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:
|