26 lines
578 B
Docker
26 lines
578 B
Docker
# Base image
|
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy the project file and restore dependencies
|
|
COPY *.fsproj .
|
|
RUN dotnet restore
|
|
|
|
# Copy the source code and build the application
|
|
COPY . .
|
|
RUN dotnet publish -c Release -o out
|
|
|
|
# Build the runtime image
|
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0
|
|
WORKDIR /app
|
|
COPY --from=build-env /app/out .
|
|
|
|
# Set the entry point command
|
|
CMD ["dotnet", "api.dll"]
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=5s --timeout=3s \
|
|
CMD curl -f http://localhost/ || exit 1
|