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