- Create Dockerfile for backend (.NET 9.0 multi-stage build) - Create Dockerfile for frontend (Node + Nginx multi-stage build) - Create nginx.conf for frontend with API proxy - Create docker-compose.yml with db, backend, frontend services - Add .dockerignore files for backend, frontend, and root - Configure health checks for all services - Configure PostgreSQL volume for persistent data Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
54 lines
1.5 KiB
Docker
54 lines
1.5 KiB
Docker
# GermanApp Backend Dockerfile
|
|
# .NET 9.0 Web API Application
|
|
# Multi-stage build for production optimization
|
|
|
|
# ============================================
|
|
# Build Stage
|
|
# ============================================
|
|
FROM mcr.microsoft.com/dotnet/sdk:9.0.204-alpine3.19 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy project file and restore dependencies
|
|
COPY ["GermanApp/GermanApp.csproj", "GermanApp/"]
|
|
RUN dotnet restore "GermanApp/GermanApp.csproj"
|
|
|
|
# Copy everything else and build
|
|
COPY . .
|
|
WORKDIR "/src/GermanApp"
|
|
RUN dotnet build "GermanApp.csproj" -c Release -o /app/build
|
|
|
|
# Publish the application
|
|
RUN dotnet publish "GermanApp.csproj" -c Release -o /app/publish \
|
|
--no-restore \
|
|
-p:PublishReadyToRun=true \
|
|
-p:PublishSingleFile=false \
|
|
-p:PublishTrimmed=true
|
|
|
|
# ============================================
|
|
# Publish Stage
|
|
# ============================================
|
|
FROM build AS publish
|
|
|
|
# ============================================
|
|
# Runtime Stage
|
|
# ============================================
|
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0.4-alpine3.19 AS runtime
|
|
WORKDIR /app
|
|
|
|
# Copy published app from publish stage
|
|
COPY --from=publish /app/publish .
|
|
|
|
# Set environment variables
|
|
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
|
ENV ASPNETCORE_URLS=http://+:8080
|
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8080/health || exit 1
|
|
|
|
# Entry point
|
|
ENTRYPOINT ["dotnet", "GermanApp.dll"]
|