-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
51 lines (35 loc) · 1.18 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
48
49
50
51
#==> Build web app
FROM node:20-alpine AS build-webapp-env
WORKDIR /app
# Git is required to generate the build info.
RUN apk add git
COPY webapp ./
# Copy the git submodule from the parent git repo.
RUN rm .git
COPY .git/modules/webapp/ .git/
# Remove "worktree" in git config to make git work.
RUN sed -i '/\Wworktree = .*/d' .git/config && \
npm i -g pnpm && \
pnpm i --frozen-lockfile && \
pnpm run build
#==> Build backend
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out --no-self-contained \
-r alpine-$([ "$(uname -m)" == aarch64 ] && echo arm64 || echo x64 )
COPY --from=build-webapp-env /app/dist/ /app/out/webapp/
#==> Build the actual app container
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
WORKDIR /app
# These are required for transcoding
RUN apk add --no-cache bash ffmpeg fdk-aac fdkaac
# Copy the published app
COPY --from=build-env /app/out .
# Make the app use "appsettings.docker.json"
ENV ASPNETCORE_ENVIRONMENT=docker
# https://github.com/dotnet/dotnet-docker/issues/3274
ENV Logging__Console__FormatterName=
ENTRYPOINT ["dotnet", "MCloudServer.dll"]