-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (24 loc) · 968 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# https://hub.docker.com/_/microsoft-dotnet
ARG BASE_IMAGE_ARCH=""
FROM mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim$BASE_IMAGE_ARCH AS base
EXPOSE 80
# Dotnet is platform agnostic anyway so only the dotnet RUNTIME needs to be arm
FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim-amd64 AS build
WORKDIR /build
# copy csproj and restore as distinct layers
COPY Backend/Helios.csproj Helios.csproj
ARG DOTNET_ARCH=x64
RUN dotnet restore "Helios.csproj" -r linux-$DOTNET_ARCH
# copy and publish app and libraries
COPY Backend .
WORKDIR /build
ARG DOTNET_ARCH=x64
RUN dotnet build "Helios.csproj" -c Release -r linux-$DOTNET_ARCH --no-restore --no-self-contained
FROM build AS publish
ARG DOTNET_ARCH=x64
RUN dotnet publish "Helios.csproj" --no-build --no-cache -c Release -r linux-$DOTNET_ARCH --no-self-contained -o /build/publish
# final stage/image
FROM base AS final
WORKDIR /app
COPY --from=publish /build/publish .
ENTRYPOINT ["dotnet", "Helios.dll"]