fix: docker-compose backend healthcheck + correct build context path

This commit is contained in:
Zhi
2026-02-27 09:37:48 +00:00
parent 1c9d76b0ce
commit 4027d0fae2
2 changed files with 24 additions and 43 deletions

View File

@@ -1,7 +1,5 @@
version: '3.8'
services:
# MySQL Database
mysql:
image: mysql:8.0
container_name: harborforge-mysql
@@ -12,13 +10,18 @@ services:
MYSQL_USER: ${MYSQL_USER:-harborforge}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-harborforge_pass}
volumes:
- mysql_data:/var/lib/mysql
- mysql_data:/var/lib/mysql
ports:
- "3306:3306"
- 3306:3306
networks:
- harborforge
- harborforge
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
test:
- CMD
- mysqladmin
- ping
- -h
- localhost
interval: 10s
timeout: 5s
retries: 5
@@ -27,11 +30,9 @@ services:
limits:
cpus: '0.5'
memory: 512M
# FastAPI Backend
backend:
build:
context: ./HarborForge.Backend/backend
context: ./HarborForge.Backend
dockerfile: Dockerfile
container_name: harborforge-backend
restart: unless-stopped
@@ -40,52 +41,32 @@ services:
SECRET_KEY: ${SECRET_KEY:-change_me_in_production}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
ports:
- "8000:8000"
- 8000:8000
depends_on:
mysql:
condition: service_healthy
networks:
- harborforge
- harborforge
volumes:
- ./HarborForge.Backend/backend:/app
- ./HarborForge.Backend:/app
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
# React Frontend (optional, for future)
# frontend:
# build:
# context: ./frontend
# dockerfile: Dockerfile
# container_name: harborforge-frontend
# restart: unless-stopped
# ports:
# - "3000:3000"
# depends_on:
# - backend
# networks:
# - harborforge
# volumes:
# - ./frontend:/app
# - /app/node_modules
# CLI (run on demand)
# cli:
# build:
# context: ./cli
# dockerfile: Dockerfile
# volumes:
# - ./cli:/app
# - ~/.harborforge:/root/.harborforge
# networks:
# - harborforge
healthcheck:
test:
- CMD
- curl
- -f
- http://localhost:8000/health
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
harborforge:
driver: bridge
volumes:
mysql_data:
driver: local