From 2aa19a5ae751b59c7dad3024c37fcafc846083f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Thierry=20K=C3=A9chichian?= Date: Mon, 4 Dec 2023 09:27:04 +0100 Subject: [PATCH] Testing docker build (#14825) --- .github/workflows/preview_ci.yml | 4 ++-- .github/workflows/release_ci.yml | 4 ++-- Dockerfile | 8 +------- Dockerfile-CI => Dockerfile-linux-CI | 6 +----- Dockerfile-windows-CI | 10 ++++++++++ 5 files changed, 16 insertions(+), 16 deletions(-) rename Dockerfile-CI => Dockerfile-linux-CI (51%) create mode 100644 Dockerfile-windows-CI diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 1ab76945246..e991162ad78 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -67,7 +67,7 @@ jobs: Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false $output = [System.IO.Path]::GetFullPath("./.build/release") dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - docker build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev . + docker build -f Dockerfile-linux-CI -t orchardproject/orchardcore-cms-linux:dev . docker push orchardproject/orchardcore-cms-linux:dev - name: Deploy preview docker image for windows if: matrix.os == 'windows-latest' @@ -76,6 +76,6 @@ jobs: Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false $output = [System.IO.Path]::GetFullPath("./.build/release") dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - docker build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev . + docker build -f Dockerfile-windows-CI -t orchardproject/orchardcore-cms-windows:dev . echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u="${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push orchardproject/orchardcore-cms-windows:dev diff --git a/.github/workflows/release_ci.yml b/.github/workflows/release_ci.yml index 07d92712ea8..5848d6b0bdf 100644 --- a/.github/workflows/release_ci.yml +++ b/.github/workflows/release_ci.yml @@ -78,7 +78,7 @@ jobs: Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false $output = [System.IO.Path]::GetFullPath("./.build/release") dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - docker build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:latest -t orchardproject/orchardcore-cms-linux:${{ steps.get_version.outputs.VERSION }} . + docker build -f Dockerfile-linux-CI -t orchardproject/orchardcore-cms-linux:latest -t orchardproject/orchardcore-cms-linux:${{ steps.get_version.outputs.VERSION }} . docker push orchardproject/orchardcore-cms-linux:latest docker push "orchardproject/orchardcore-cms-linux:${{ steps.get_version.outputs.VERSION }}" - name: Deploy preview docker image for windows @@ -88,7 +88,7 @@ jobs: Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false $output = [System.IO.Path]::GetFullPath("./.build/release") dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - docker build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:latest -t orchardproject/orchardcore-cms-windows:${{ steps.get_version.outputs.VERSION }} . + docker build -f Dockerfile-windows-CI -t orchardproject/orchardcore-cms-windows:latest -t orchardproject/orchardcore-cms-windows:${{ steps.get_version.outputs.VERSION }} . echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u="${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push orchardproject/orchardcore-cms-windows:latest docker push "orchardproject/orchardcore-cms-windows:${{ steps.get_version.outputs.VERSION }}" diff --git a/Dockerfile b/Dockerfile index 85b899d1c23..0c1f69e2ce3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,3 @@ -FROM --platform=$BUILDPLATFORM golang:alpine AS build -ARG TARGETOS - FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env LABEL stage=build-env WORKDIR /app @@ -10,10 +7,7 @@ COPY ./src /app RUN dotnet publish /app/OrchardCore.Cms.Web -c Release -o ./build/release --framework net8.0 # Build runtime image -FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-1809 AS build_windows -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS build_linux -FROM build_${TARGETOS} AS aspnet - +FROM mcr.microsoft.com/dotnet/aspnet:8.0 EXPOSE 80 ENV ASPNETCORE_URLS http://+:80 WORKDIR /app diff --git a/Dockerfile-CI b/Dockerfile-linux-CI similarity index 51% rename from Dockerfile-CI rename to Dockerfile-linux-CI index f118690e976..1a019b53864 100644 --- a/Dockerfile-CI +++ b/Dockerfile-linux-CI @@ -1,11 +1,7 @@ # This Docker file is intended for the CI # A prerequisite is a published application in the .build/release -FROM --platform=$BUILDPLATFORM golang:alpine AS build -ARG TARGETOS -FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-1809 AS build_windows -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS build_linux -FROM build_${TARGETOS} AS aspnet +FROM mcr.microsoft.com/dotnet/aspnet:8.0 EXPOSE 80 ENV ASPNETCORE_URLS http://+:80 diff --git a/Dockerfile-windows-CI b/Dockerfile-windows-CI new file mode 100644 index 00000000000..4db8aab657d --- /dev/null +++ b/Dockerfile-windows-CI @@ -0,0 +1,10 @@ +# This Docker file is intended for the CI +# A prerequisite is a published application in the .build/release + +FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-1809 + +EXPOSE 80 +ENV ASPNETCORE_URLS http://+:80 +WORKDIR /app +COPY .build/release /app +ENTRYPOINT ["dotnet", "OrchardCore.Cms.Web.dll"]