forked from EdiWang/Moonglade
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 905 Bytes
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 905 Bytes
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
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
# If use aspnet:7.0-alpine, see https://github.com/dotnet/dotnet-docker/issues/1366
#RUN apk add --no-cache tzdata
# Captcha font
COPY ./build/OpenSans-Regular.ttf /usr/share/fonts/OpenSans-Regular.ttf
WORKDIR /app
EXPOSE 80
EXPOSE 443
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
# Auto copy to prevent 996
COPY ./src/**/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done
RUN dotnet restore "Moonglade.Web/Moonglade.Web.csproj"
COPY ./src .
WORKDIR "/src/Moonglade.Web"
RUN dotnet build "Moonglade.Web.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Moonglade.Web.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Moonglade.Web.dll"]