Created
April 11, 2025 19:58
-
-
Save bjoerntx/fc32dca5f21da312c43e80473b3e6fb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. | |
# This stage is used when running from VS in fast mode (Default for Debug configuration) | |
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base | |
WORKDIR /app | |
EXPOSE 8080 | |
EXPOSE 8081 | |
# This stage is used to build the service project | |
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | |
ARG BUILD_CONFIGURATION=Release | |
WORKDIR /src | |
COPY ["tx-web-api-core.csproj", "tx-web-api-core/"] | |
COPY ["nuget.config", "tx-web-api-core/"] | |
RUN dotnet restore "./tx-web-api-core/tx-web-api-core.csproj" | |
WORKDIR "/src/tx-web-api-core" | |
COPY . . | |
RUN dotnet build "tx-web-api-core.csproj" -c $BUILD_CONFIGURATION -o /app/build | |
# This stage is used to publish the service project to be copied to the final stage | |
FROM build AS publish | |
ARG BUILD_CONFIGURATION=Release | |
RUN dotnet publish "./tx-web-api-core.csproj" -c $BUILD_CONFIGURATION -r linux-x64 -o /app/publish /p:UseAppHost=false | |
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) | |
FROM base AS final | |
WORKDIR /app | |
COPY --from=publish /app/publish . | |
ENTRYPOINT ["dotnet", "tx-web-api-core.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment