From 3f40d8c28cee502057c9c9b6bd0f48f0679a801c Mon Sep 17 00:00:00 2001 From: Jasmin Savard Date: Sun, 15 Nov 2020 01:31:57 -0500 Subject: [PATCH] Release CI - Perf adjustments (#7641) --- .dockerignore | 10 ++++++---- .github/workflows/release_ci.yml | 12 ++++++++++-- .vscode/launch.json | 8 ++++---- .vscode/tasks.json | 12 ++++++------ Dockerfile-CI | 10 ++++++++++ Dockerfile-CI.dockerignore | 7 +++++++ 6 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 Dockerfile-CI create mode 100644 Dockerfile-CI.dockerignore diff --git a/.dockerignore b/.dockerignore index 89a7f874a27..d055c334463 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,12 +1,14 @@ -#ignore all +# ignore all ** -#except src for build +# Except src for building !./src/* +# TODO : Remove this line when Docker Buildkit works in Windows +!/.build/release/* -#ignore any App_Data folder +# Ignore any App_Data folder **/App_Data/ -#ignore all prebuild +# Ignore all prebuild **/[b|B]in/ **/[O|o]bj/ diff --git a/.github/workflows/release_ci.yml b/.github/workflows/release_ci.yml index 2503a8dba8b..9547f712a59 100644 --- a/.github/workflows/release_ci.yml +++ b/.github/workflows/release_ci.yml @@ -60,12 +60,20 @@ jobs: password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Deploy preview docker image for linux if: matrix.os == 'ubuntu-latest' + # Buildkit Only working in linux + env: + DOCKER_BUILDKIT: 1 run: | - docker build -t orchardproject/orchardcore-cms-linux:dev . + rm -rf ./src/OrchardCore.Cms.Web/App_Data + dotnet publish -c Release -o ./.build/release --no-build --no-restore + docker build -f Dockerfile-CI -t orchardproject/orchardcore-cms-linux:dev . + echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u="${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin docker push orchardproject/orchardcore-cms-linux - name: Deploy preview docker image for windows if: matrix.os == 'windows-latest' run: | - docker build -t orchardproject/orchardcore-cms-windows:dev . + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item + dotnet publish -c Release -o ./.build/release --no-build --no-restore + docker build -f Dockerfile-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 diff --git a/.vscode/launch.json b/.vscode/launch.json index bc22f40f624..34a66032b07 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -72,9 +72,9 @@ "request": "launch", "internalConsoleOptions": "openOnSessionStart", "preLaunchTask": "Web App: Dotnet Publish (framework dependent)", - "program": "${workspaceRoot}/build/release/OrchardCore.Cms.Web.dll", + "program": "${workspaceRoot}/.build/release/OrchardCore.Cms.Web.dll", "args": [], - "cwd": "${workspaceRoot}/build/release", + "cwd": "${workspaceRoot}/.build/release", "stopAtEntry": false, "launchBrowser": { "enabled": true, @@ -91,9 +91,9 @@ "request": "launch", "internalConsoleOptions": "openOnSessionStart", "preLaunchTask": "Web App: Dotnet Publish (self-contained)", - "program": "${workspaceRoot}/build/release/OrchardCore.Cms.Web.dll", + "program": "${workspaceRoot}/.build/release/OrchardCore.Cms.Web.dll", "args": [], - "cwd": "${workspaceRoot}/build/release", + "cwd": "${workspaceRoot}/.build/release", "stopAtEntry": false, "launchBrowser": { "enabled": true, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 97e5f3a1d2a..526548fccc4 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -81,12 +81,12 @@ "windows":{ "command": "Remove-Item", "args": [ - "${workspaceRoot}\\build\\release\\*", "-recurse" + "${workspaceRoot}\\.build\\release\\*", "-recurse" ] }, "args": [ "-rfv", - "${workspaceRoot}/build/release/*" + "${workspaceRoot}/.build/release/*" ] }, { @@ -100,7 +100,7 @@ "--configuration", "release", "--runtime", "win-x64", "--self-contained", - "--output", ".\\build\\release" + "--output", ".\\.build\\release" ] }, "args": [ @@ -108,7 +108,7 @@ "--configuration", "release", "--runtime", "linux-x64", "--self-contained", - "--output", "./build/release" + "--output", "./.build/release" ], "problemMatcher": "$msCompile" }, @@ -123,7 +123,7 @@ "--configuration", "release", "--runtime", "win-x64", "--self-contained", "false", - "--output", ".\\build\\release" + "--output", ".\\.build\\release" ] }, "args": [ @@ -131,7 +131,7 @@ "--configuration", "release", "--runtime", "linux-x64", "--self-contained", "false", - "--output", "./build/release" + "--output", "./.build/release" ], "problemMatcher": "$msCompile" }, diff --git a/Dockerfile-CI b/Dockerfile-CI new file mode 100644 index 00000000000..14b5ef8b050 --- /dev/null +++ b/Dockerfile-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/core/aspnet:3.1 + +EXPOSE 80 +ENV ASPNETCORE_URLS http://+:80 +WORKDIR /app +COPY .build/release /app +ENTRYPOINT ["dotnet", "OrchardCore.Cms.Web.dll"] diff --git a/Dockerfile-CI.dockerignore b/Dockerfile-CI.dockerignore new file mode 100644 index 00000000000..8a790ea4840 --- /dev/null +++ b/Dockerfile-CI.dockerignore @@ -0,0 +1,7 @@ +# Buildkit Only working in linux + +# Ignore all +** + +# Except precompiled files +!/.build/release/*