🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
1.3 KiB
Docker
51 lines
1.3 KiB
Docker
# ColaFlow API Dockerfile
|
|
# Multi-stage build for .NET 9 application
|
|
|
|
# Stage 1: Build
|
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy solution and project files
|
|
COPY ColaFlow.sln .
|
|
COPY src/ColaFlow.Domain/ColaFlow.Domain.csproj src/ColaFlow.Domain/
|
|
COPY src/ColaFlow.Application/ColaFlow.Application.csproj src/ColaFlow.Application/
|
|
COPY src/ColaFlow.Infrastructure/ColaFlow.Infrastructure.csproj src/ColaFlow.Infrastructure/
|
|
COPY src/ColaFlow.API/ColaFlow.API.csproj src/ColaFlow.API/
|
|
|
|
# Restore dependencies
|
|
RUN dotnet restore
|
|
|
|
# Copy all source files
|
|
COPY src/ src/
|
|
|
|
# Build the application
|
|
WORKDIR /src/src/ColaFlow.API
|
|
RUN dotnet build -c Release -o /app/build --no-restore
|
|
|
|
# Stage 2: Publish
|
|
FROM build AS publish
|
|
RUN dotnet publish -c Release -o /app/publish --no-restore
|
|
|
|
# Stage 3: Runtime
|
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
|
|
WORKDIR /app
|
|
|
|
# Install curl for healthcheck
|
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy published files
|
|
COPY --from=publish /app/publish .
|
|
|
|
# Expose ports
|
|
EXPOSE 8080 8081
|
|
|
|
# Set environment
|
|
ENV ASPNETCORE_URLS=http://+:8080;https://+:8081
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=40s \
|
|
CMD curl -f http://localhost:8080/health || exit 1
|
|
|
|
# Entry point
|
|
ENTRYPOINT ["dotnet", "ColaFlow.API.dll"]
|