-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCauldron.Dockerfile
More file actions
72 lines (58 loc) · 2.69 KB
/
Cauldron.Dockerfile
File metadata and controls
72 lines (58 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# ==============================================================================
# CAULDRON - BLAZOR SERVER DOCKERFILE
# ==============================================================================
# Multi-stage build to optimize final image size
# Stage 1: Build with full SDK (~1 GB)
# Stage 2: Runtime with ASP.NET Core Runtime only (~200 MB)
# ==============================================================================
# BUILD ARGUMENTS
# ==============================================================================
# Version is passed from docker-compose or GitHub Actions
ARG VERSION=latest
# ==============================================================================
# STAGE 1: BUILD
# ==============================================================================
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy project file and dependencies (for optimal layer caching)
COPY ["Cauldron/Cauldron.csproj", "Cauldron/"]
COPY ["Cauldron/Directory.Build.props", "Directory.Build.props"]
# Restore NuGet dependencies (cached layer if .csproj doesn't change)
RUN dotnet restore "Cauldron/Cauldron.csproj"
# Copy all source code
COPY Cauldron/ Cauldron/
# Build application in Release mode
WORKDIR "/src/Cauldron"
RUN dotnet build "Cauldron.csproj" -c Release -o /app/build
# ==============================================================================
# STAGE 2: PUBLISH
# ==============================================================================
FROM build AS publish
RUN dotnet publish "Cauldron.csproj" \
-c Release \
-o /app/publish \
/p:UseAppHost=false
# ==============================================================================
# STAGE 3: RUNTIME (FINAL IMAGE)
# ==============================================================================
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
WORKDIR /app
# Re-declare ARG for use in this stage
ARG VERSION=latest
# Metadata labels (OCI standard)
LABEL org.opencontainers.image.title="Cauldron"
LABEL org.opencontainers.image.description="A magical witch assistant equipped with an enchanted AI-driven grimoire (FrontEnd)"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.authors="Marco De Salvo"
LABEL org.opencontainers.image.url="https://github.com/mdesalvo/Morgana"
LABEL org.opencontainers.image.source="https://github.com/mdesalvo/Morgana"
LABEL org.opencontainers.image.licenses="Apache-2.0"
# Expose port 5002 for HTTP
EXPOSE 5002
# Copy compiled binaries from publish stage
COPY --from=publish /app/publish .
# Configure ASP.NET Core environment variables
ENV ASPNETCORE_URLS=http://+:5002
ENV ASPNETCORE_ENVIRONMENT=Production
# Application startup
ENTRYPOINT ["dotnet", "Cauldron.dll"]