From 6623037971e96748e34cef8edfd3e0aae3505c88 Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:00:42 +0100 Subject: [PATCH] Use alpine instead of debian/ubuntu to shrink image size (#164) --- src/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index 2032640..5192cb1 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -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 @@ -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