opencand/OpenCand.ETL.dockerfile
2025-05-31 10:58:30 -03:00

27 lines
1.1 KiB
Docker

# ─── Stage 1: Build ───────────────────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy only the solution and project files first, restore, then copy the rest
COPY ./OpenCand.sln ./
COPY ./OpenCand.ETL/OpenCand.ETL.csproj ./OpenCand.ETL/
COPY ./OpenCand.Core/OpenCand.Core.csproj ./OpenCand.Core/
RUN dotnet restore ./OpenCand.ETL/OpenCand.ETL.csproj
# Now copy the rest of the ETL source code
COPY ./OpenCand.ETL/. ./OpenCand.ETL/
COPY ./OpenCand.Core/. ./OpenCand.Core/
WORKDIR /src/OpenCand.ETL
RUN dotnet publish -c Release -o /app/publish
# ─── Stage 2: Runtime ─────────────────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
WORKDIR /app
COPY --from=build /app/publish .
ENV ConnectionStrings__DefaultConnection="Host=db;Port=5432;Database=opencand;Username=root;Password=root"
ENTRYPOINT ["dotnet", "OpenCand.ETL.dll"]