forked from rnwood/smtp4dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.windows
More file actions
53 lines (39 loc) · 1.6 KB
/
Dockerfile.windows
File metadata and controls
53 lines (39 loc) · 1.6 KB
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
# escape=`
FROM mcr.microsoft.com/powershell:nanoserver-1809 AS downloadnodejs
ENV NODE_VERSION 14.16.0
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"]
RUN Invoke-WebRequest -OutFile \"$($env:TEMP)\nodejs.zip\" -UseBasicParsing \"https://nodejs.org/dist/v$($env:NODE_VERSION)/node-v$($env:NODE_VERSION)-win-x64.zip\" ; `
Expand-Archive \"$($env:TEMP)\nodejs.zip\" -DestinationPath C:\ ; `
Rename-Item \"C:\node-v$($env:NODE_VERSION)-win-x64\" c:\nodejs
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
COPY --from=downloadnodejs C:\nodejs C:\Windows\system32\
WORKDIR /app
# confirm installation
RUN node -v
RUN npm -v
# copy csproj and restore as distinct layers
COPY *.sln .
COPY Rnwood.Smtp4dev/*.csproj ./Rnwood.Smtp4dev/
RUN dotnet restore Rnwood.Smtp4dev
# copy everything else and build app
COPY /Rnwood.Smtp4dev/ClientApp /app/Rnwood.Smtp4dev/ClientApp
COPY /Rnwood.Smtp4dev/Rnwood.Smtp4dev.csproj /app/Rnwood.Smtp4dev
WORKDIR /app/Rnwood.Smtp4dev
RUN dotnet msbuild -p:Configuration=Release -t:NpmInstall -t:DebugRunNpm
COPY / /app
ARG version
ENV VERSION=$version
RUN echo Version is %VERSION%
RUN dotnet build --no-restore -c Release -p:SkipClientApp=true -p:Version=%VERSION%
FROM build AS publish
WORKDIR /app/Rnwood.Smtp4dev
RUN echo Version is %VERSION%
RUN dotnet publish --no-restore -c Release -o out -p:SkipClientApp=true -p:Version=%VERSION%
FROM mcr.microsoft.com/dotnet/aspnet:6.0.5 AS final
COPY --from=publish /app/Rnwood.Smtp4dev/out /app
EXPOSE 80
EXPOSE 25
EXPOSE 143
VOLUME c:\smtp4dev
WORKDIR c:\
ENTRYPOINT ["dotnet", "/app/Rnwood.Smtp4dev.dll"]