Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfiles for 7.0.200 and remove PublishSingleFile #4534

Merged
merged 12 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ See [Hosting ASP.NET Core Images with Docker over HTTPS](https://github.com/dotn
## Linux amd64 Tags
Tags | Dockerfile | OS Version
-----------| -------------| -------------
dotnetapp-alpine-slim-amd64, dotnetapp, latest | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/Dockerfile.alpine-x64-slim) | Alpine
dotnetapp-alpine-slim-amd64, dotnetapp, latest | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/Dockerfile.alpine-slim) | Alpine
aspnetapp-alpine-slim-amd64, aspnetapp | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/aspnetapp/Dockerfile.alpine-slim) | Alpine

## Linux arm32 Tags
Tags | Dockerfile | OS Version
-----------| -------------| -------------
dotnetapp-alpine-slim-arm32v7, dotnetapp, latest | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/Dockerfile.alpine-arm32-slim) | Alpine
dotnetapp-alpine-slim-arm32v7, dotnetapp, latest | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/Dockerfile.alpine-slim) | Alpine
aspnetapp-alpine-slim-arm32v7, aspnetapp | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/aspnetapp/Dockerfile.alpine-slim) | Alpine

## Linux arm64 Tags
Tags | Dockerfile | OS Version
-----------| -------------| -------------
dotnetapp-alpine-slim-arm64v8, dotnetapp, latest | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/Dockerfile.alpine-arm64-slim) | Alpine
dotnetapp-alpine-slim-arm64v8, dotnetapp, latest | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/Dockerfile.alpine-slim) | Alpine
aspnetapp-alpine-slim-arm64v8, aspnetapp | [Dockerfile](https://github.com/dotnet/dotnet-docker/blob/main/samples/aspnetapp/Dockerfile.alpine-slim) | Alpine

## Nano Server 2022 amd64 Tags
Expand Down
6 changes: 3 additions & 3 deletions manifest.samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"platforms": [
{
"dockerfile": "samples/dotnetapp/Dockerfile.alpine-x64-slim",
"dockerfile": "samples/dotnetapp/Dockerfile.alpine-slim",
"os": "linux",
"osVersion": "alpine",
"tags": {
Expand All @@ -40,7 +40,7 @@
},
{
"architecture": "arm",
"dockerfile": "samples/dotnetapp/Dockerfile.alpine-arm32-slim",
"dockerfile": "samples/dotnetapp/Dockerfile.alpine-slim",
"os": "linux",
"osVersion": "alpine",
"tags": {
Expand All @@ -50,7 +50,7 @@
},
{
"architecture": "arm64",
"dockerfile": "samples/dotnetapp/Dockerfile.alpine-arm64-slim",
"dockerfile": "samples/dotnetapp/Dockerfile.alpine-slim",
"os": "linux",
"osVersion": "alpine",
"tags": {
Expand Down
34 changes: 19 additions & 15 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
# .NET Docker samples
# .NET container samples

The following samples and guidance demonstrate how to use .NET and Docker for development, testing and production. You can use the samples as the basis of your own Docker images or just to learn.
The following samples and guidance demonstrate how to use .NET and Docker for development, testing and production. You can equally use the samples for learning about containers or as the basis of your own container images.

## Building images

* [Build a .NET Docker image](dotnetapp/README.md)
* [Build an ASP.NET Core Docker image](aspnetapp/README.md)
* [Build and test a multi-project solution](complexapp/README.md)
* [Building a globalization aware (or unaware) image](globalapp/README.md)
* [Build a .NET container image](dotnetapp/README.md)
* [Build an ASP.NET Core container image](aspnetapp/README.md)
* [Building a globalization and time zone aware (or unaware) image](globalapp/README.md)
* [Container best practices](container-best-practices.md)
* [Build for a platform](build-for-a-platform.md)
* [Enable (or disable) globalization](enable-globalization.md)

## Development guidance

* [Establishing a Docker environment](establishing-docker-environment.md)
* [Selecting .NET image tags](selecting-tags.md)
* [Selecting .NET image tags](../documentation/supported-tags.md)
* [Enable (or disable) globalization](enable-globalization.md)
* [Build and test a multi-project solution](complexapp/README.md)
* [Run test in a container](run-tests-in-sdk-container.md)
* [Build in an SDK container](build-in-sdk-container.md)
* [Run applications in an SDK container](run-in-sdk-container.md)
* [Run ASP.NET Core Applications in development with Docker and HTTPS](run-aspnetcore-https-development.md)
* [Run ASP.NET Core Applications in development with container and HTTPS](run-aspnetcore-https-development.md)
* [Discover licensing for Linux image contents](https://github.com/dotnet/dotnet-docker/blob/main/documentation/image-artifact-details.md)

## Hosting guidance

* [Host ASP.NET Core Images with Docker and HTTPS](host-aspnetcore-https.md)
* [Push Docker Images to Azure Container Registry](push-image-to-acr.md)
* [Push Docker Images to Docker Hub](push-image-to-dockerhub.md)
* [Host ASP.NET Core Images with container and HTTPS](host-aspnetcore-https.md)
* [Push container images to Azure Container Registry](push-image-to-acr.md)
* [Push container images to Docker Hub](push-image-to-dockerhub.md)
* [Deploy ASP.NET Core Applications to Azure Container Instances](deploy-container-to-aci.md)

## Scenario guidance
## Other documentation

You can find tips and tricks, best practices, and samples of commonly used technology in the [.NET Docker scenarios documentation](../documentation/scenarios/README.md).
* [Introduction to .NET and Docker](https://learn.microsoft.com/dotnet/core/docker/)]
* [Announcing built-in container support for the .NET SDK](https://devblogs.microsoft.com/dotnet/announcing-builtin-container-support-for-the-dotnet-sdk/)
* [Staying safe in containers](https://devblogs.microsoft.com/dotnet/staying-safe-with-dotnet-containers/)
* [Improving multi-platform container support](https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/)
* [Container blog posts](https://devblogs.microsoft.com/dotnet/category/containers/)

## Try pre-built images

Expand Down
6 changes: 4 additions & 2 deletions samples/aspnetapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# https://hub.docker.com/_/microsoft-dotnet
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /source

Expand All @@ -8,7 +9,8 @@ RUN dotnet restore --use-current-runtime

# copy everything else and build app
COPY aspnetapp/. .
RUN dotnet publish -c Release -o /app --use-current-runtime --self-contained false --no-restore
RUN dotnet publish --use-current-runtime --self-contained false --no-restore -o /app


# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
Expand Down
7 changes: 5 additions & 2 deletions samples/aspnetapp/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build

WORKDIR /source
Expand All @@ -8,9 +10,10 @@ RUN dotnet restore --use-current-runtime

# copy everything else and build app
COPY aspnetapp/. .
RUN dotnet publish --use-current-runtime -c Release --self-contained false --no-restore -o /app
RUN dotnet publish --use-current-runtime --self-contained false --no-restore -o /app

# To enable globalization:

# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine
Expand Down
19 changes: 0 additions & 19 deletions samples/aspnetapp/Dockerfile.alpine-arm32

This file was deleted.

19 changes: 0 additions & 19 deletions samples/aspnetapp/Dockerfile.alpine-arm32-slim

This file was deleted.

19 changes: 0 additions & 19 deletions samples/aspnetapp/Dockerfile.alpine-arm64

This file was deleted.

19 changes: 0 additions & 19 deletions samples/aspnetapp/Dockerfile.alpine-arm64-slim

This file was deleted.

7 changes: 5 additions & 2 deletions samples/aspnetapp/Dockerfile.alpine-icu
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build

WORKDIR /source
Expand All @@ -8,9 +10,10 @@ RUN dotnet restore --use-current-runtime

# copy everything else and build app
COPY aspnetapp/. .
RUN dotnet publish --use-current-runtime -c Release --self-contained false --no-restore -o /app
RUN dotnet publish --use-current-runtime --self-contained false --no-restore -o /app

# To learn about globalization:

# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine
Expand Down
4 changes: 3 additions & 1 deletion samples/aspnetapp/Dockerfile.alpine-non-root
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/nightly/sdk:8.0-preview-alpine AS build
ARG TARGETARCH
WORKDIR /source
Expand All @@ -11,7 +13,7 @@ COPY aspnetapp/. .
RUN dotnet publish -a $TARGETARCH --self-contained false --no-restore -o /app


# To enable globalization:
# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md
# final stage/image
# .NET 8 tag includes `-preview`
Expand Down
8 changes: 5 additions & 3 deletions samples/aspnetapp/Dockerfile.alpine-slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# https://hub.docker.com/_/microsoft-dotnet
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
WORKDIR /source

Expand All @@ -8,9 +9,10 @@ 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
RUN dotnet publish --use-current-runtime --no-restore -o /app /p:PublishTrimmed=true /p:PublishReadyToRun=true

# To enable globalization:

# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime-deps:7.0-alpine
Expand Down
19 changes: 0 additions & 19 deletions samples/aspnetapp/Dockerfile.alpine-x64

This file was deleted.

19 changes: 0 additions & 19 deletions samples/aspnetapp/Dockerfile.alpine-x64-slim

This file was deleted.

8 changes: 5 additions & 3 deletions samples/aspnetapp/Dockerfile.chiseled
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# https://hub.docker.com/_/microsoft-dotnet
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM mcr.microsoft.com/dotnet/sdk:7.0-jammy AS build
WORKDIR /source

Expand All @@ -8,10 +9,11 @@ RUN dotnet restore --use-current-runtime

# copy everything else and build app
COPY aspnetapp/. .
RUN dotnet publish -c Release -o /app --use-current-runtime --self-contained false --no-restore
RUN dotnet publish --use-current-runtime --self-contained false --no-restore -o /app


# final stage/image
FROM mcr.microsoft.com/dotnet/nightly/aspnet:7.0-jammy-chiseled
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "aspnetapp.dll"]
ENTRYPOINT ["./aspnetapp.dll"]
19 changes: 19 additions & 0 deletions samples/aspnetapp/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS build
WORKDIR /source

# copy csproj and restore as distinct layers
COPY aspnetapp/*.csproj .
RUN dotnet restore --use-current-runtime

# copy everything else and build app
COPY aspnetapp/. .
RUN dotnet publish --use-current-runtime --self-contained false --no-restore -o /app


# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["./aspnetapp.dll"]
17 changes: 0 additions & 17 deletions samples/aspnetapp/Dockerfile.debian-arm32

This file was deleted.

17 changes: 0 additions & 17 deletions samples/aspnetapp/Dockerfile.debian-arm64

This file was deleted.

Loading