# Set the base image FROM mcr.microsoft.com/dotnet/sdk:7.0.202-jammy-arm64v8 AS build # Set the working directory WORKDIR /src # Copy the project files COPY 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 . . # Clean RUN dotnet clean "Expedience.Models/Expedience.Models.csproj" RUN dotnet clean "Expedience.Infrastructure/Expedience.Infrastructure.csproj" RUN dotnet clean "Expedience.Api/Expedience.Api.csproj" # 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/aspnet:7.0.4-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 7033 # Set the entry point for the container ENTRYPOINT ["dotnet", "Expedience.Api.dll"]