34 lines
867 B
Docker
34 lines
867 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 khmereid_backend/*.csproj ./
|
|
|
|
# Restore dependencies
|
|
RUN dotnet restore
|
|
|
|
# Copy the rest of the application code
|
|
COPY khmereid_backend/ ./
|
|
|
|
# Build the application
|
|
# Change to Release for prod
|
|
RUN dotnet publish khmereid_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 khmereid_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", "khmereid_backend.dll"]
|