Add bare image option

This commit is contained in:
Jeff Leung 2024-02-27 19:29:32 -08:00
parent 7d5b2a7aac
commit feb1326cee
1 changed files with 24 additions and 0 deletions

View File

@ -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"]