-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (30 loc) · 1.19 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
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
# Build webapp
FROM node:14 AS build_webapp
COPY pgo-web-frontend pgo-web-frontend
WORKDIR pgo-web-frontend
ENV PGO_FRONTEND_BUILD_OUTPUT_DIR=/webapp
RUN npm ci
RUN npm run build -- --no-clean
# When part of the Docker image, the webapp's start page should be in a slightly different place:
RUN mv /webapp/index.html /webapp/index_webapp.html
# Build Sintef.Pgo.REST
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["Sintef.Pgo/REST API/Sintef.Pgo.REST/", "Sintef.Pgo/REST API/Sintef.Pgo.REST/"]
RUN dotnet restore "Sintef.Pgo/REST API/Sintef.Pgo.REST/Sintef.Pgo.REST.csproj"
COPY . .
RUN dotnet build "Sintef.Pgo/REST API/Sintef.Pgo.REST/Sintef.Pgo.REST.csproj" -c Release -o /app/build
# Include webapp
COPY --from=build_webapp ["/webapp", "Sintef.Pgo/REST API/Sintef.Pgo.REST/wwwroot"]
# Publish Sintef.Pgo.REST
FROM build AS publish
WORKDIR /src
RUN dotnet publish "Sintef.Pgo/REST API/Sintef.Pgo.REST/Sintef.Pgo.REST.csproj" -c Release -f net7.0 -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["dotnet", "Sintef.Pgo.REST.dll"]