-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.WebApp
69 lines (48 loc) · 2.19 KB
/
Dockerfile.WebApp
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
66
67
68
69
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS prebuild-env
ARG NUGET_USER
ARG NUGET_TOKEN
WORKDIR /app
ENV CONTAINER_IMAGE_BUILD=true
COPY ./global.json ./
COPY ./MuzakBot.sln ./
COPY ./Directory.Build.props ./
COPY ./Directory.Packages.props ./
COPY ./nuget.config ./
RUN dotnet nuget update source smalls1652-github --username "${NUGET_USER}" --password "${NUGET_TOKEN}" --store-password-in-clear-text
COPY ./src/App/App.csproj ./src/App/
COPY ./src/Lib/Lib.csproj ./src/Lib/
COPY ./src/Lib.Services/Lib.Services.csproj ./src/Lib.Services/
COPY ./src/GeniusService/GeniusService.csproj ./src/GeniusService/
COPY ./src/Hosting/Hosting.csproj ./src/Hosting/
COPY ./src/Database/Database.csproj ./src/Database/
COPY ./src/DatabaseDesign/DatabaseDesign.csproj ./src/DatabaseDesign/
COPY ./src/WebApp/WebApp.csproj ./src/WebApp/
RUN dotnet restore
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.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
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 publish ./src/WebApp --configuration "Release" --os "${TARGETOS}" --arch "${TARGETARCH}" --no-restore
RUN rm -rf /app/artifacts/publish/WebApp/release/*.pdb; \
rm -rf /app/artifacts/publish/WebApp/release/*.dbg
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:9.0-noble-chiseled AS app
ARG TARGETOS
ARG TARGETARCH
COPY --from=build-env /app/artifacts/publish/WebApp/release /app
WORKDIR /app
ENTRYPOINT ["dotnet", "MuzakBot.WebApp.dll"]
EXPOSE 8080