-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
23 lines (21 loc) · 1.35 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
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
WORKDIR /app
# these RUN lines below is optimization for current experiment to account for the fact that I have multiple similar configuration
# best practices of Docker building imply that I put all dependencies in single line
RUN apk add clang libexecinfo binutils musl-dev build-base zlib-static
RUN apk add cmake
RUN apk add openssl-dev openssl-libs-static
COPY nuget.config .
COPY OpenSslEmbedding.csproj .
RUN dotnet restore --runtime linux-musl-x64 OpenSslEmbedding.csproj
# Remove once System.Security.Cryptography.Native can be statically linked using default build process
COPY Microsoft.NETCore.Native.Unix.targets /root/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.0-alpha.1.23058.2/build/Microsoft.NETCore.Native.Unix.targets
COPY System.Security.Cryptography.Native /root/.nuget/packages/runtime.linux-musl-x64.microsoft.dotnet.ilcompiler/8.0.0-alpha.1.23058.2/native/src/libs/System.Security.Cryptography.Native
COPY build-local.sh /root/.nuget/packages/runtime.linux-musl-x64.microsoft.dotnet.ilcompiler/8.0.0-alpha.1.23058.2/native/src/libs/build-local.sh
COPY . .
RUN dotnet publish -c Release -r linux-musl-x64 -o out OpenSslEmbedding.csproj
FROM scratch AS runtime
WORKDIR /app
COPY --from=build /app/out/* /app/
COPY --from=build /etc/ssl/certs/* /etc/ssl/certs/
ENTRYPOINT ["/app/OpenSslEmbedding"]