Skip to content

Commit

Permalink
Moving old port for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
merschformann committed Nov 4, 2024
1 parent 7e6fc7d commit 06abf3a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions SC.Service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

# >>> 1st stage: build the application
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG TARGETARCH
ARG BUILDPLATFORM
Expand All @@ -13,17 +9,21 @@ RUN dotnet restore "SC.Service/SC.Service.csproj"
WORKDIR "/src/SC.Service"
RUN dotnet build "SC.Service.csproj" -c Release -o /app/build -a $TARGETARCH

# >>> 2nd stage: publish the application
FROM build AS publish
RUN dotnet publish "SC.Service.csproj" -c Release -o /app/publish \
--self-contained true \
/p:PublishTrimmed=true \
/p:PublishSingleFile=true \
-a $TARGETARCH

FROM --platform=$BUILDPLATFORM base AS final
# >>> 3rd stage: create the final image
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine AS final
LABEL org.opencontainers.image.source="https://github.com/merschformann/sardine-can"
ARG TARGETARCH
ARG BUILDPLATFORM
ENV ASPNETCORE_HTTP_PORTS=80
EXPOSE 80
WORKDIR /app

# create a new user and change directory ownership
RUN adduser --disabled-password \
Expand All @@ -32,7 +32,7 @@ RUN adduser --disabled-password \

# impersonate into the new user
USER dotnetuser
WORKDIR /app

# copy the published files and configure the entrypoint
COPY --from=publish /app/publish .
ENTRYPOINT ["./SC.Service"]

0 comments on commit 06abf3a

Please sign in to comment.