Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile.alpine-non-root #4515

Merged
merged 3 commits into from
Mar 29, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions samples/aspnetapp/Dockerfile.alpine-non-root
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/nightly/sdk:8.0-preview-alpine AS build
ARG TARGETARCH
WORKDIR /source

# copy csproj and restore as distinct layers
COPY aspnetapp/*.csproj .
RUN dotnet restore --use-current-runtime
RUN dotnet restore -a $TARGETARCH

# copy everything else and build app
COPY aspnetapp/. .
RUN dotnet publish --use-current-runtime -c Release --self-contained false --no-restore -o /app
RUN dotnet publish -a $TARGETARCH --self-contained false --no-restore -o /app


# To enable globalization:
Expand All @@ -20,9 +20,10 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview-alpine
# These ENVs are only needed because the sample uses .NET 7
ENV DOTNET_ROLL_FORWARD=Major
ENV DOTNET_ROLL_FORWARD_PRE_RELEASE=1
ENV APP_UID=64198
richlander marked this conversation as resolved.
Show resolved Hide resolved

WORKDIR /app
COPY --from=build /app .

USER app
USER $APP_UID
ENTRYPOINT ["./aspnetapp"]