forked from microsoft/garnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.nanoserver
More file actions
34 lines (24 loc) · 1.04 KB
/
Dockerfile.nanoserver
File metadata and controls
34 lines (24 loc) · 1.04 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
ARG TAG=ltsc2022
FROM mcr.microsoft.com/dotnet/sdk:9.0-nanoserver-$TAG AS build
ENV NUGET_PACKAGES=/src/pkg
WORKDIR /src
# Copy files
COPY . .
# Set protected mode to no for Docker images
USER ContainerAdministrator
RUN pwsh -Command "(Get-Content /src/libs/host/defaults.conf) -replace '\""ProtectedMode\"": \"yes\",', '\""ProtectedMode\"": \"no\",' | Set-Content /src/libs/host/defaults.conf"
USER ContainerUser
WORKDIR /src/main/GarnetServer
# Restore, build, and publish
RUN dotnet restore && \
dotnet build -c Release -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false && \
dotnet publish -c Release -o /app -r win-x64 --self-contained false -f net8.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false
# Delete xmldoc files
RUN pwsh -Command "gci -Path /app -Filter '*.xml' -Recurse | del -Force"
# Final stage/image
FROM mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-$TAG AS runtime
WORKDIR /app
COPY --from=build /app .
# For inter-container communication.
EXPOSE 6379
ENTRYPOINT ["/app/GarnetServer"]