now up and running using docker

This commit is contained in:
2025-04-17 15:22:55 +02:00
parent 5337da219e
commit 22b6f3bd2a
10 changed files with 80 additions and 117 deletions

View File

@@ -1,32 +1,34 @@
services:
db:
image: mariadb
image: postgres:16
container_name: wagfarm-db
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: ${DB_DATABASE}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_DATABASE}
volumes:
- ./data/mysql:/var/lib/mysql
# - ./postgres-init:/docker-entrypoint-initdb.d # SQL scripts
- pgdata:/var/lib/postgresql/data
networks:
- wagfarm-net
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
interval: 5s
test: ["CMD-SHELL", "pg_isready", "-U", "${DB_USER}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
api:
build: ./wagfarm-api
container_name: wagfarm-api
restart: always
environment:
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PORT}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_NAME=${DB_DATABASE}
- GIN_MODE=${GIN_MODE}
ports:
- "8089:8080"
depends_on:
@@ -34,6 +36,15 @@ services:
condition: service_healthy
networks:
- wagfarm-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"] # or use the health endpoint of your API
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
networks:
wagfarm-net:
wagfarm-net:
volumes:
pgdata: