-
Notifications
You must be signed in to change notification settings - Fork 241
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (32 loc) · 1.44 KB
/
Dockerfile
File metadata and controls
38 lines (32 loc) · 1.44 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
# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine AS base
USER root
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
# Define a build argument for the OpenSSL version
# lookup for openssl+branch version here https://pkgs.alpinelinux.org/packages?name=openssl&branch=v3.20&repo=&arch=x86_64
ARG OPENSSL_VERSION=1.1.1w-r1
ARG ALPINE_BRANCH=v3.16
# Add the specified Alpine branch repository and install OpenSSL
RUN echo "http://dl-cdn.alpinelinux.org/alpine/${ALPINE_BRANCH}/main" >> /etc/apk/repositories && \
apk add --no-cache openssl=${OPENSSL_VERSION} wget perl build-base && \
rm -rf /var/lib/apt/lists/*
# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Kestrel.csproj", "."]
RUN dotnet restore "./Kestrel.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "./Kestrel.csproj" -c $BUILD_CONFIGURATION -o /app/build
# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Kestrel.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT [ "dotnet", "Kestrel.dll" ]