-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.GeniusService
56 lines (37 loc) · 1.65 KB
/
Dockerfile.GeniusService
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
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
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/GeniusService --configuration "Release" --os "${TARGETOS}" --arch "${TARGETARCH}" --no-restore
RUN rm -rf /app/artifacts/publish/GeniusService/release/*.pdb; \
rm -rf /app/artifacts/publish/GeniusService/release/*.dbg
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:9.0-noble-chiseled AS app
ARG TARGETOS
ARG TARGETARCH
COPY --from=build-env /app/artifacts/publish/GeniusService/release /app
WORKDIR /app
ENTRYPOINT ["dotnet", "MuzakBot.GeniusService.dll"]