Created
January 12, 2024 15:36
-
-
Save dontpaniclabsgists/3714446da8adaec35bcd51b7c4bbae0a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Stage 1: Build the application | |
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | |
WORKDIR /src | |
# Copy the client1 project files | |
COPY client1/. ./client1/ | |
COPY serviceA/. ./serviceA/ | |
COPY serviceB/. ./serviceB/ | |
WORKDIR /src/client1 | |
RUN dotnet build -c Release -o /app/build | |
# Stage 2: Publish the application | |
FROM build AS publish | |
RUN dotnet publish -c Release -o /app/publish | |
# Stage 3: Create the final image | |
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS final | |
WORKDIR /app | |
# Use a non-root user for enhanced security | |
USER nobody:nogroup | |
EXPOSE 80 | |
# Copy the published files from the ‘publish’ stage | |
COPY --from=publish /app/publish . | |
# Define the entry point | |
ENTRYPOINT [“dotnet”, “client1.dll”] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment