-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (38 loc) · 1.58 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Build Angular
FROM --platform=amd64 node:20-alpine AS frontend
WORKDIR /app
COPY ./angular /app/
RUN npm install -g pnpm
RUN pnpm install
RUN pnpm run build
# Build ASP.NET Core
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
USER app
WORKDIR /app
EXPOSE 8080
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG TARGETARCH
ARG BUILD_CONFIGURATION=Release
COPY ./ /src
WORKDIR /src
COPY ["aspnet-core/src/CoMon.Web.Host/CoMon.Web.Host.csproj", "aspnet-core/src/CoMon.Web.Host/"]
COPY ["aspnet-core/src/CoMon.Web.Core/CoMon.Web.Core.csproj", "aspnet-core/src/CoMon.Web.Core/"]
COPY ["aspnet-core/src/CoMon.Application/CoMon.Application.csproj", "aspnet-core/src/CoMon.Application/"]
COPY ["aspnet-core/src/CoMon.Core/CoMon.Core.csproj", "aspnet-core/src/CoMon.Core/"]
COPY ["aspnet-core/src/CoMon.EntityFrameworkCore/CoMon.EntityFrameworkCore.csproj", "aspnet-core/src/CoMon.EntityFrameworkCore/"]
RUN dotnet restore "./aspnet-core/src/CoMon.Web.Host/CoMon.Web.Host.csproj" -a $TARGETARCH
COPY . .
WORKDIR "/src/aspnet-core/src/CoMon.Web.Host"
RUN dotnet build "./CoMon.Web.Host.csproj" -c $BUILD_CONFIGURATION -o /app/build -a $TARGETARCH
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./CoMon.Web.Host.csproj" -c $BUILD_CONFIGURATION -o /app/publish -a $TARGETARCH --self-contained true
FROM base AS final
WORKDIR /app
USER root
RUN mkdir /data && chown -R app:app /data
RUN apk add iputils-ping icu-libs icu-data-full
USER app
COPY --from=publish /app/publish .
COPY --from=frontend /app/dist /app/wwwroot
ENTRYPOINT ["./CoMon.Web.Host"]