Docker compose / Fix build ?
Build App / Build (push) Failing after 2s

This commit is contained in:
2026-08-06 11:00:55 +02:00
parent a9860f4c94
commit c9a3c252e1
6 changed files with 184 additions and 15 deletions
+80
View File
@@ -0,0 +1,80 @@
# Local development stack: LaDOSE.Api + LaDOSE.WebApp, built from the two Dockerfiles
# already in the tree.
#
# docker compose up --build start both, rebuilding when a Dockerfile changed
# docker compose watch same, plus rebuild the service you are editing
# docker compose logs -f api follow the API
# docker compose down stop
#
# Then: webapp on http://localhost:8080, API on http://localhost:5000,
# Scalar API reference on http://localhost:5000/scalar.
#
# The database is NOT part of this stack — it stays wherever appsettings.json points.
# Copy .env.example to .env to change the ports, the connection string or the API keys.
name: ladose
services:
api:
build:
context: ./LaDOSE.Src
dockerfile: Dockerfile
args:
# Debug, not Release: /openapi/v1.json and /scalar are compiled out of a
# Release build. See the comment in LaDOSE.Src/Dockerfile.
BUILD_CONFIGURATION: Debug
environment:
# Startup.cs gates the developer exception page, MapOpenApi() and
# MapScalarApiReference() on IsDevelopment().
ASPNETCORE_ENVIRONMENT: Development
# Double underscore is the .NET section separator, so this overrides
# ConnectionStrings:DbContext from appsettings.json. Left unset in .env, the
# default below reproduces what is committed there.
ConnectionStrings__DbContext: ${LADOSE_DB_CONNECTION:-Host=kafka.local;Username=tom;Password=tom;Database=ladoseapi}
# appsettings.json ships placeholders for these three. Real values belong in
# .env, which git ignores.
JWTTokenSecret: ${LADOSE_JWT_SECRET:-dev-only-secret-not-for-any-deployed-environment}
ApiKey__SmashApiKey: ${LADOSE_SMASH_API_KEY:-}
ApiKey__ChallongeApiKey: ${LADOSE_CHALLONGE_API_KEY:-}
ports:
# Container side is pinned at 5000: Program.cs reads AllowedHosts/Port straight
# from appsettings.json, through a ConfigurationBuilder that ignores env vars.
- "${LADOSE_API_PORT:-5000}:5000"
extra_hosts:
# Lets LADOSE_DB_CONNECTION use Host=host.docker.internal to reach a Postgres
# running on the machine hosting the containers.
- "host.docker.internal:host-gateway"
develop:
watch:
- action: rebuild
path: ./LaDOSE.Src
ignore:
- LaDOSE.WebApp/
- "**/bin/"
- "**/obj/"
web:
build:
context: ./LaDOSE.Src/LaDOSE.WebApp
dockerfile: Dockerfile
# VITE_API_BASE_URL is deliberately not passed. Vite would inline it at build
# time; LADOSE_API_BASE_URL below is read at container start instead, so the
# port can change without rebuilding the image.
environment:
# docker-entrypoint.sh turns this into /config.js. It is resolved by the
# *browser*, so it must be a host-visible URL — not http://api:5000.
LADOSE_API_BASE_URL: ${LADOSE_API_BASE_URL:-http://localhost:${LADOSE_API_PORT:-5000}}
ports:
- "${LADOSE_WEB_PORT:-8080}:80"
depends_on:
# Ordering only. The SPA is served by nginx and talks to the API from the
# browser, so it comes up fine on its own; this just avoids a confusing
# first-load failure when starting both at once.
- api
develop:
watch:
- action: rebuild
path: ./LaDOSE.Src/LaDOSE.WebApp
ignore:
- node_modules/
- build/
- .svelte-kit/