-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
62 lines (51 loc) · 2.06 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
52
53
54
55
56
57
58
59
60
61
62
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS base
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
DOTNET_CLI_UI_LANGUAGE=en-US \
DOTNET_SVCUTIL_TELEMETRY_OPTOUT=1 \
DOTNET_NOLOGO=1 \
POWERSHELL_TELEMETRY_OPTOUT=1 \
POWERSHELL_UPDATECHECK_OPTOUT=1 \
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 \
DOTNET_ROLL_FORWARD=Major \
DOTNET_ROLL_FORWARD_TO_PRERELEASE=1 \
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
NUGET_CERT_REVOCATION_MODE=offline
RUN apk add --no-cache icu-libs tzdata
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS sdk
FROM sdk AS nodejs
RUN apk add --update npm
FROM nodejs as restore-npm
WORKDIR /build
COPY ["src/DoggyFrictions.ExternalApi/package.json", "src/DoggyFrictions.ExternalApi/"]
COPY ["src/DoggyFrictions.ExternalApi/package-lock.json", "src/DoggyFrictions.ExternalApi/"]
WORKDIR /build/src/DoggyFrictions.ExternalApi
RUN NODE_ENV=development npm install
FROM sdk AS restore-dotnet
WORKDIR /build
COPY ["src/DoggyFrictions.ExternalApi/DoggyFrictions.ExternalApi.csproj", "src/DoggyFrictions.ExternalApi/"]
COPY ["tests/DoggyFrictions.ExternalApi.Tests/DoggyFrictions.ExternalApi.Tests.csproj", "tests/DoggyFrictions.ExternalApi.Tests/"]
COPY ["Directory.Build.props", "."]
COPY ["DoggyFrictions.sln", "."]
RUN dotnet restore
FROM restore-npm AS gulp-prod
WORKDIR /build/src/DoggyFrictions.ExternalApi
COPY ["src/DoggyFrictions.ExternalApi/gulpfile.js", "."]
COPY ["src/DoggyFrictions.ExternalApi/wwwroot", "wwwroot"]
COPY ["src/DoggyFrictions.ExternalApi/Styles", "Styles"]
RUN ./node_modules/gulp-cli/bin/gulp.js prod
FROM restore-dotnet AS copy-all
WORKDIR /build
COPY . .
FROM copy-all AS build
WORKDIR /build
RUN dotnet build -c Release --no-restore
FROM build AS publish
WORKDIr /build/src/DoggyFrictions.ExternalApi
COPY --from=gulp-prod /build/src/DoggyFrictions.ExternalApi/wwwroot wwwroot
RUN dotnet publish "DoggyFrictions.ExternalApi.csproj" --no-build -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DoggyFrictions.ExternalApi.dll"]