-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from Antonytm/feature/docker
Docker: Integration tests + Dianoga Docker Assets Images
- Loading branch information
Showing
58 changed files
with
2,060 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: "Publish to Docker" | ||
description: "Pushes built artifacts to Docker" | ||
inputs: | ||
build_configuration: | ||
description: "Debug/Release" | ||
required: true | ||
dotnet_version: | ||
description: "net45/net46/net471/net48/etc" | ||
required: true | ||
username: | ||
description: "Docker registry username" | ||
required: true | ||
password: | ||
description: "Docker registry password" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: mr-smithers-excellent/docker-build-push@v5 | ||
name: Build & push Docker image | ||
with: | ||
image: antonytm/dianoga-assets | ||
tags: 6.0.0-beta.2-${{ inputs.dotnet_version }}-${{ inputs.build_configuration }}-${{ github.run_number }}, latest-${{ inputs.dotnet_version }}-${{ inputs.build_configuration }} | ||
registry: docker.io | ||
dockerfile: Dockerfile | ||
username: ${{ inputs.username }} | ||
password: ${{ inputs.password }} | ||
buildArgs: | | ||
BUILD_CONFIGURATION=${{ inputs.build_configuration }}, DOTNET_VERSION_ARG=${{ inputs.dotnet_version }} |
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,20 @@ | ||
name: Dianoga Docker CI, .NET 4.5.2, Debug | ||
on: | ||
push: | ||
branches: [ feature/docker ] | ||
env: | ||
BUILD_CONFIGURATION: Debug | ||
DIANOGA_DOTNET_VERSION: net452 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run custom action | ||
uses: ./.github/actions/publish-docker-hub | ||
with: | ||
build_configuration: ${{ env.BUILD_CONFIGURATION }} | ||
dotnet_version: ${{ env.DIANOGA_DOTNET_VERSION }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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,20 @@ | ||
name: Dianoga Docker CI, .NET 4.5.2, Release | ||
on: | ||
push: | ||
branches: [ feature/docker ] | ||
env: | ||
BUILD_CONFIGURATION: Release | ||
DIANOGA_DOTNET_VERSION: net452 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run custom action | ||
uses: ./.github/actions/publish-docker-hub | ||
with: | ||
build_configuration: ${{ env.BUILD_CONFIGURATION }} | ||
dotnet_version: ${{ env.DIANOGA_DOTNET_VERSION }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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,20 @@ | ||
name: Dianoga Docker CI, .NET 4.6.2, Debug | ||
on: | ||
push: | ||
branches: [ feature/docker ] | ||
env: | ||
BUILD_CONFIGURATION: Debug | ||
DIANOGA_DOTNET_VERSION: net462 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run custom action | ||
uses: ./.github/actions/publish-docker-hub | ||
with: | ||
build_configuration: ${{ env.BUILD_CONFIGURATION }} | ||
dotnet_version: ${{ env.DIANOGA_DOTNET_VERSION }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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,20 @@ | ||
name: Dianoga Docker CI, .NET 4.6.2, Release | ||
on: | ||
push: | ||
branches: [ feature/docker ] | ||
env: | ||
BUILD_CONFIGURATION: Release | ||
DIANOGA_DOTNET_VERSION: net462 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run custom action | ||
uses: ./.github/actions/publish-docker-hub | ||
with: | ||
build_configuration: ${{ env.BUILD_CONFIGURATION }} | ||
dotnet_version: ${{ env.DIANOGA_DOTNET_VERSION }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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,20 @@ | ||
name: Dianoga Docker CI, .NET 4.7.1, Debug | ||
on: | ||
push: | ||
branches: [ feature/docker ] | ||
env: | ||
BUILD_CONFIGURATION: Debug | ||
DIANOGA_DOTNET_VERSION: net471 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run custom action | ||
uses: ./.github/actions/publish-docker-hub | ||
with: | ||
build_configuration: ${{ env.BUILD_CONFIGURATION }} | ||
dotnet_version: ${{ env.DIANOGA_DOTNET_VERSION }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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,20 @@ | ||
name: Dianoga Docker CI, .NET 4.7.1, Release | ||
on: | ||
push: | ||
branches: [ feature/docker ] | ||
env: | ||
BUILD_CONFIGURATION: Release | ||
DIANOGA_DOTNET_VERSION: net471 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run custom action | ||
uses: ./.github/actions/publish-docker-hub | ||
with: | ||
build_configuration: ${{ env.BUILD_CONFIGURATION }} | ||
dotnet_version: ${{ env.DIANOGA_DOTNET_VERSION }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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,20 @@ | ||
name: Dianoga Docker CI, .NET 4.8, Debug | ||
on: | ||
push: | ||
branches: [ feature/docker ] | ||
env: | ||
BUILD_CONFIGURATION: Debug | ||
DIANOGA_DOTNET_VERSION: net48 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run custom action | ||
uses: ./.github/actions/publish-docker-hub | ||
with: | ||
build_configuration: ${{ env.BUILD_CONFIGURATION }} | ||
dotnet_version: ${{ env.DIANOGA_DOTNET_VERSION }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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,20 @@ | ||
name: Dianoga Docker CI, .NET 4.8, Release | ||
on: | ||
push: | ||
branches: [ feature/docker ] | ||
env: | ||
BUILD_CONFIGURATION: Release | ||
DIANOGA_DOTNET_VERSION: net48 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run custom action | ||
uses: ./.github/actions/publish-docker-hub | ||
with: | ||
build_configuration: ${{ env.BUILD_CONFIGURATION }} | ||
dotnet_version: ${{ env.DIANOGA_DOTNET_VERSION }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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,50 @@ | ||
# escape=` | ||
|
||
ARG BASE_IMAGE=mcr.microsoft.com/windows/nanoserver:1809 | ||
ARG BUILD_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8 | ||
|
||
FROM ${BUILD_IMAGE} AS build-env | ||
ARG BUILD_CONFIGURATION= | ||
ARG DOTNET_VERSION_ARG= | ||
|
||
WORKDIR / | ||
# Add Sitecore Nuget source | ||
RUN dotnet nuget add source https://sitecore.myget.org/F/sc-packages/api/v3/index.json | ||
|
||
# Copy csproj and restore as distinct layers | ||
COPY *.sln ./ | ||
COPY src/Dianoga/Dianoga.csproj ./src/Dianoga/ | ||
COPY src/Dianoga.Tests/Dianoga.Tests.csproj ./src/Dianoga.Tests/ | ||
RUN dotnet restore | ||
|
||
# Copy everything else and build | ||
COPY src ./src | ||
RUN dotnet build -c $env:BUILD_CONFIGURATION | ||
RUN mkdir ./src/bin | ||
RUN Copy ./src/Dianoga/bin/$env:BUILD_CONFIGURATION/$env:DOTNET_VERSION_ARG/Dianoga.* ./src/bin/ | ||
RUN Copy ./src/Dianoga/bin/$env:BUILD_CONFIGURATION/$env:DOTNET_VERSION_ARG/System.Threading.Tasks.Dataflow.dll ./src/bin/ | ||
|
||
FROM ${BASE_IMAGE} | ||
|
||
# Copy Dianoga dll and pdb (if present) | ||
COPY --from=build-env /src/bin/ ./module/cd/content/bin/ | ||
COPY --from=build-env /src/bin/ ./module/cm/content/bin/ | ||
|
||
|
||
# Copy Dianoga Tools | ||
ARG src="/src/Dianoga/Dianoga Tools" | ||
ARG target="./module/cd/content/App_Data/Dianoga Tools" | ||
COPY --from=build-env ${src} ${target} | ||
|
||
ARG src="/src/Dianoga/Dianoga Tools" | ||
ARG target="./module/cd/content/App_Data/Dianoga Tools" | ||
COPY --from=build-env ${src} ${target} | ||
|
||
# Copy Configs | ||
ARG src="/src/Dianoga/Default Config Files" | ||
ARG target="./module/cm/content/App_Config/Include/Dianoga" | ||
COPY --from=build-env ${src} ${target} | ||
|
||
ARG src="/src/Dianoga/Default Config Files" | ||
ARG target="./module/cd/content/App_Config/Include/Dianoga" | ||
COPY --from=build-env ${src} ${target} |
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,17 @@ | ||
# folders | ||
.git | ||
.gitignore | ||
.vs | ||
.vscode | ||
build | ||
docker | ||
packages | ||
**/bin/ | ||
**/obj/ | ||
**/out/ | ||
|
||
# files | ||
*Dockerfile | ||
docker-compose* | ||
**/*.md | ||
*.ps1 |
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,49 @@ | ||
# escape=` | ||
|
||
ARG BASE_IMAGE | ||
ARG BUILD_IMAGE | ||
|
||
FROM ${BUILD_IMAGE} AS prep | ||
ARG BUILD_CONFIGURATION | ||
RUN echo $env:BUILD_CONFIGURATION | ||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
# Gather only artifacts necessary for NuGet restore, retaining directory structure | ||
COPY *.sln NuGet.config Directory.Build.targets Packages.props nuget\ | ||
COPY src\ \temp\ | ||
RUN Invoke-Expression 'robocopy C:\temp C:\nuget\src /s /ndl /njh /njs *.csproj *.scproj packages.config' | ||
|
||
FROM ${BUILD_IMAGE} AS builder | ||
|
||
ARG BUILD_CONFIGURATION | ||
RUN echo $env:BUILD_CONFIGURATION | ||
|
||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
# Create an empty working directory | ||
WORKDIR C:\build | ||
|
||
# Copy prepped NuGet artifacts, and restore as distinct layer to take better advantage of caching | ||
COPY --from=prep .\nuget .\ | ||
RUN nuget restore | ||
|
||
# Copy remaining source code | ||
COPY src\ .\src\ | ||
|
||
# Copy transforms, retaining directory structure | ||
RUN Invoke-Expression 'robocopy C:\build\src C:\out\transforms /s /ndl /njh /njs *.xdt' | ||
|
||
# Build website with file publish | ||
RUN msbuild .\src\src\Dianoga\Dianoga.csproj /p:Configuration=$env:BUILD_CONFIGURATION /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:PublishUrl=C:\out\website | ||
|
||
# Build XConnect with file publish | ||
RUN msbuild .\src\DockerExamples.XConnect\DockerExamples.XConnect.csproj /p:Configuration=$env:BUILD_CONFIGURATION /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:PublishUrl=C:\out\xconnect | ||
|
||
FROM ${BASE_IMAGE} | ||
|
||
WORKDIR C:\artifacts | ||
|
||
# Copy final build artifacts | ||
COPY --from=builder C:\out\website .\website\ | ||
COPY --from=builder C:\out\transforms .\transforms\ | ||
COPY --from=builder C:\out\xconnect .\xconnect\ |
Oops, something went wrong.