2026-04-26 17:28:06 +00:00
|
|
|
# ── Stage 1: Build ──────────────────────────────────────────
|
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
|
|
|
|
# Copy csproj first for layer caching — restores before copying source
|
|
|
|
|
COPY Extrudex.csproj .
|
|
|
|
|
RUN dotnet restore
|
|
|
|
|
|
|
|
|
|
# Copy the rest of the source
|
|
|
|
|
COPY . .
|
|
|
|
|
RUN dotnet publish Extrudex.csproj \
|
|
|
|
|
-c Release \
|
|
|
|
|
-o /app/publish \
|
|
|
|
|
--no-restore
|
|
|
|
|
|
|
|
|
|
# ── Stage 2: Runtime ────────────────────────────────────────
|
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
feat(CUB-64): Docker runtime setup for development & deployment
- Backend Dockerfile: added curl install for health check (not in aspnet base image)
- Frontend Dockerfile: multi-stage Angular build with nginx serving
- Frontend nginx.conf: SPA routing, API proxy, SignalR WebSocket support, health endpoint
- Frontend .dockerignore: excludes node_modules, dist, .angular, etc.
- docker-compose.dev.yml: added PostgreSQL service, fixed frontend context path,
renamed web service from control-center-web to extrudex-web, added DB env vars,
proper service dependencies with health checks
- deploy.sh: updated service list to include PostgreSQL port
2026-04-27 08:33:18 +00:00
|
|
|
# Install curl for health check (not included in aspnet base image)
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2026-04-26 17:28:06 +00:00
|
|
|
# Non-root user for security
|
|
|
|
|
RUN adduser --disabled-password --gecos "" appuser
|
|
|
|
|
USER appuser
|
|
|
|
|
|
|
|
|
|
# Copy published output from build stage
|
|
|
|
|
COPY --from=build /app/publish .
|
|
|
|
|
|
|
|
|
|
# ASP.NET Core listens on 8080 by default in .NET 8+
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
|
|
# Health check against /health endpoint
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
|
|
|
CMD curl --fail http://localhost:8080/health || exit 1
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["dotnet", "Extrudex.dll"]
|