You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.2 KiB
Docker

# Set the base image
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy-arm64v8 AS build
# Set the working directory
WORKDIR /src
# Copy the project files
COPY ./ExpediencePlugin/Expedience.Models/Expedience.Models.csproj Expedience.Models/
COPY ./Expedience.Infrastructure/Expedience.Infrastructure.csproj Expedience.Infrastructure/
COPY ./Expedience.Api/Expedience.Api.csproj Expedience.Api/
# Restore the packages
RUN dotnet restore Expedience.Api/Expedience.Api.csproj
COPY . .
# Build the project
RUN dotnet build "Expedience.Api/Expedience.Api.csproj" -c Release -o /app/build
# Publish the project
ARG TARGET_RUNTIME=linux-x64
RUN dotnet publish "Expedience.Api/Expedience.Api.csproj" -c Release -o /app/publish --self-contained --runtime $TARGET_RUNTIME
# Set the base image for the final runtime
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy-arm64v8
# Set the working directory
WORKDIR /app
# Copy the published files
COPY --from=build /app/publish .
# Set the ASPNETCORE_ENVIRONMENT environment variable
ENV ASPNETCORE_ENVIRONMENT=Production
# Expose the port the application will run on
EXPOSE 80
# Set the entry point for the container
ENTRYPOINT ["dotnet", "Expedience.Api.dll"]