-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51f5be8
commit 578955b
Showing
6 changed files
with
197 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY aspnetapp/*.csproj . | ||
RUN dotnet restore --use-current-runtime /p:PublishReadyToRun=true | ||
|
||
# copy everything else and build app | ||
COPY aspnetapp/. . | ||
RUN dotnet publish -c Release -o /app --use-current-runtime --no-restore /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/runtime-deps:7.0-alpine | ||
WORKDIR /app | ||
COPY --from=build /app . | ||
|
||
# This port needs to match the port being used | ||
HEALTHCHECK CMD wget -qO- -t1 http://localhost:80/healthz || exit 1 | ||
ENTRYPOINT ["./aspnetapp"] | ||
|
||
# See: https://github.com/dotnet/announcements/issues/20 | ||
# Uncomment to enable globalization APIs (or delete) | ||
# ENV \ | ||
# DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ | ||
# LC_ALL=en_US.UTF-8 \ | ||
# LANG=en_US.UTF-8 | ||
# RUN apk add --no-cache \ | ||
# icu-data-full \ | ||
# icu-libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# escape=` | ||
|
||
ARG TAG=ltsc2022 | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY aspnetapp/*.csproj . | ||
RUN dotnet restore --use-current-runtime /p:PublishReadyToRun=true | ||
|
||
# copy everything else and build app | ||
COPY aspnetapp/. . | ||
RUN dotnet publish -c Release -o /app --use-current-runtime --no-restore /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/windows/nanoserver:$TAG | ||
WORKDIR /app | ||
COPY --from=build /app . | ||
HEALTHCHECK CMD curl -sf --show-error http://localhost:80/healthz || exit 1 | ||
ENV ` | ||
# Configure web servers to bind to port 80 when present | ||
ASPNETCORE_URLS=http://+:80 ` | ||
# Enable detection of running in a container | ||
DOTNET_RUNNING_IN_CONTAINER=true | ||
|
||
ENTRYPOINT ["aspnetapp"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters