Skip to content

Commit

Permalink
Use alpine instead of debian/ubuntu to shrink image size
Browse files Browse the repository at this point in the history
  • Loading branch information
AB-xdev committed Oct 16, 2024
1 parent 4abc2d6 commit 8b8b5f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Stage 1: Build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 as source
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine as source
ARG target="Release"

RUN apt-get update && apt-get install unzip -y
RUN apk add --no-cache unzip curl bash

WORKDIR /src

Expand All @@ -19,11 +19,11 @@ RUN dotnet publish -c $target -o obj/docker/publish
RUN cp -r /src/obj/docker/publish /OpenIdConnectServerMock

# Stage 2: Release
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0 as release
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-alpine as release
ARG target="Release"

RUN apt-get update && apt-get install curl -y && rm -rf /var/lib/apt/lists/*
RUN if [ $target = "Debug" ]; then apt-get install unzip && rm -rf /var/lib/apt/lists/* && curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /vsdbg; fi
RUN apk add --no-cache curl
RUN if [ $target = "Debug" ]; then apk add --no-cache bash unzip && curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /vsdbg; fi

COPY --from=source /OpenIdConnectServerMock /OpenIdConnectServerMock
WORKDIR /OpenIdConnectServerMock
Expand Down

0 comments on commit 8b8b5f0

Please sign in to comment.