2025-10-28 13:38:57 +07:00

34 lines
872 B
Docker

# Use the .NET SDK image for building the application
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
# Copy the project files
COPY khmer_eid_backend/*.csproj ./
# Restore dependencies
RUN dotnet restore
# Copy the rest of the application code
COPY khmer_eid_backend/ ./
# Build the application
# Change to Release for prod
RUN dotnet publish khmer_eid_backend.csproj -c Debug -o out
# Use the .NET runtime image for running the application
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app
# Copy published output
COPY --from=build /app/out ./
# Copy Program.cs into the runtime image so you can inspect it
COPY khmer_eid_backend/Program.cs ./
# Install vim
RUN apt-get update && apt-get install -y vim && rm -rf /var/lib/apt/lists/*
# Expose the port and run the application
EXPOSE 5000
ENTRYPOINT ["dotnet", "khmer_eid_backend.dll"]