From feb1326cee9e2584d76fb4c8405f9c8ba0b14d9e Mon Sep 17 00:00:00 2001 From: Jeff Leung Date: Tue, 27 Feb 2024 19:29:32 -0800 Subject: [PATCH] Add bare image option --- .../Dockerfile.bare-image | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 AS1024.GeoFeed.MinimalAPI/Dockerfile.bare-image diff --git a/AS1024.GeoFeed.MinimalAPI/Dockerfile.bare-image b/AS1024.GeoFeed.MinimalAPI/Dockerfile.bare-image new file mode 100644 index 0000000..a1edb90 --- /dev/null +++ b/AS1024.GeoFeed.MinimalAPI/Dockerfile.bare-image @@ -0,0 +1,24 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build +# Install clang/zlib1g-dev dependencies for publishing to native +RUN apk add clang zlib-static zlib-dev musl-dev libc6-compat cmake autoconf make openssl-dev openssl-libs-static icu-static icu-dev +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["AS1024.GeoFeed.MinimalAPI/AS1024.GeoFeed.MinimalAPI.csproj", "AS1024.GeoFeed.MinimalAPI/"] +RUN dotnet restore "./AS1024.GeoFeed.MinimalAPI/./AS1024.GeoFeed.MinimalAPI.csproj" +COPY . . +WORKDIR "/src/AS1024.GeoFeed.MinimalAPI" +RUN dotnet build "./AS1024.GeoFeed.MinimalAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./AS1024.GeoFeed.MinimalAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publish -r linux-musl-x64 /p:StaticOpenSslLinking=true /p:StaticExecutable=true /p:StaticallyLinked=true /p:StripSymbols=true /p:DebugType=None /p:DebugSymbols=false + +FROM scratch AS final +WORKDIR /app +EXPOSE 8080 +COPY --from=publish /app/publish . +COPY --from=build /etc/ssl/certs/* /etc/ssl/certs/ +RUN --mount=type=tmpfs /tmp +ENTRYPOINT ["./AS1024.GeoFeed.MinimalAPI"] \ No newline at end of file