Build bare image version of app for Linux docker

This commit is contained in:
Jeff Leung 2024-08-15 17:53:56 -07:00
parent 9a4487165b
commit caaa8dcccf
1 changed files with 6 additions and 11 deletions

View File

@ -1,15 +1,8 @@
#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/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
# Install clang/zlib1g-dev dependencies for publishing to native
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
clang zlib1g-dev
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.NetworkQuality.Server/AS1024.NetworkQuality.Server.csproj", "AS1024.NetworkQuality.Server/"]
@ -20,9 +13,11 @@ RUN dotnet build "./AS1024.NetworkQuality.Server.csproj" -c $BUILD_CONFIGURATION
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./AS1024.NetworkQuality.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=true
RUN dotnet publish "./AS1024.NetworkQuality.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0 AS final
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final
WORKDIR /tmp
WORKDIR /app
EXPOSE 8080
COPY --from=publish /app/publish .