-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.AdminSite
65 lines (47 loc) · 2.38 KB
/
Dockerfile.AdminSite
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS prebuild-env
WORKDIR /app
COPY ./global.json ./
COPY ./SmallsOnline.Web.sln ./
COPY ./Directory.Build.props ./
COPY ./Directory.Packages.props ./
COPY ./nuget.config ./
COPY ./src/AdminSite/Client/AdminSite.Client.csproj ./src/AdminSite/Client/
COPY ./src/AdminSite/Server/AdminSite.Server.csproj ./src/AdminSite/Server/
COPY ./src/Lib/Lib.csproj ./src/Lib/
COPY ./src/Lib.Components/Lib.Components.csproj ./src/Lib.Components/
COPY ./src/Lib.Services/Lib.Services.csproj ./src/Lib.Services/
COPY ./src/PublicSite/Client/PublicSite.Client.csproj ./src/PublicSite/Client/
COPY ./src/PublicSite/Server/PublicSite.Server.csproj ./src/PublicSite/Server/
COPY ./src/Tools/BlogPublisher/BlogPublisher.csproj ./src/Tools/BlogPublisher/
COPY ./src/Tools/NginxTemplateCustomizer/NginxTemplateCustomizer.csproj ./src/Tools/NginxTemplateCustomizer/
RUN dotnet restore
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
ARG TARGETOS
ARG TARGETARCH
ENV CONTAINER_IMAGE_BUILD=true
ENV NODE_MAJOR=20
RUN apt-get update; \
apt-get install -y ca-certificates curl gnupg; \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
apt-get update; \
apt-get install -y nodejs python3 libc++1 libatomic1; \
curl -qL https://www.npmjs.com/install.sh | sh ;\
apt-get clean
RUN dotnet tool install --global PowerShell; \
dotnet workload install wasm-tools
WORKDIR /app
ADD --keep-git-dir=true ./ ./
COPY --from=prebuild-env /root/.nuget/packages /root/.nuget/packages
COPY --from=prebuild-env /app/artifacts /app/artifacts
RUN dotnet msbuild "./src/AdminSite/Server/" -t:"InitProject_Combined"; \
dotnet restore "./src/AdminSite/Server/"; \
dotnet publish "./src/AdminSite/Server/" --configuration "Release" --os "${TARGETOS}" --arch "${TARGETARCH}" --no-restore
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS app
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY --from=build-env /app/artifacts/publish/AdminSite.Server/release .
ENTRYPOINT [ "dotnet", "SmallsOnline.Web.AdminSite.Server.dll" ]
EXPOSE 8080