feat: auto-start Spring Boot backend via docker-compose

Replace the devcontainer (sleep infinity + VS Code image) with a proper
dev setup:
- Dockerfile: eclipse-temurin:21-jdk-alpine running ./mvnw spring-boot:run
- Source mounted at /app, Maven deps cached in named volume maven_cache
- Healthcheck on /actuator/health so frontend waits until backend is ready
- frontend depends_on backend: service_healthy (was service_started)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-17 22:19:59 +01:00
parent 3280125140
commit 9b67db74eb
2 changed files with 18 additions and 11 deletions

View File

@@ -64,11 +64,11 @@ services:
context: ./backend
dockerfile: Dockerfile
container_name: archive-backend
command: sleep infinity
restart: unless-stopped
volumes:
- .:/workspaces/familienarchiv:cached
- ./import:/import # Mappt den lokalen Ordner "import-data" auf "/import" im Container
- ./backend:/app
- ./import:/import
- maven_cache:/root/.m2
depends_on:
db:
condition: service_healthy
@@ -78,16 +78,21 @@ services:
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/${POSTGRES_DB}
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER}
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD}
# MinIO Konfiguration für Spring Boot (S3)
S3_ENDPOINT: http://minio:9000
S3_ACCESS_KEY: ${MINIO_ROOT_USER}
S3_SECRET_KEY: ${MINIO_ROOT_PASSWORD}
S3_BUCKET_NAME: ${MINIO_DEFAULT_BUCKETS}
S3_REGION: us-east-1 # MinIO Standard
S3_REGION: us-east-1
ports:
- "${PORT_BACKEND}:8080"
networks:
- archive-net
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/actuator/health | grep -q UP || exit 1"]
interval: 15s
timeout: 5s
retries: 10
start_period: 60s
# --- Frontend: SvelteKit (Dev Server) ---
frontend:
@@ -102,7 +107,7 @@ services:
minio:
condition: service_healthy
backend:
condition: service_started
condition: service_healthy
volumes:
- ./frontend:/app
# Keep container's node_modules separate from host to avoid OS binary conflicts
@@ -123,3 +128,4 @@ networks:
volumes:
frontend_node_modules:
maven_cache: