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 helix-basic-aspnetcore project for SC 10.2 #160

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Welcome to the Sitecore Helix Examples Repository
The objective of this repository is to set up Sitecore helix project on any topology means xp0, xp1 and xm1 dynamically which will reduce your time to setup insatnce.

The Sitecore Helix Examples are demonstrations of Sitecore Helix practices across various
tooling and business scenarios. They are intended to demonstrate a wider variety
Expand Down
13 changes: 8 additions & 5 deletions examples/helix-basic-aspnetcore/.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ RENDERING_HOST=www.basic-company-aspnetcore.localhost
SITECORE_DOCKER_REGISTRY=scr.sitecore.com/sxp/
SITECORE_MODULE_REGISTRY=scr.sitecore.com/sxp/modules/
SITECORE_TOOLS_REGISTRY=scr.sitecore.com/tools/
SITECORE_VERSION=10.1-ltsc2019
HEADLESS_SERVICES_VERSION=18.0-1809
MANAGEMENT_SERVICES_VERSION=4.0-1809
TOOLS_VERSION=10.1-1809
SITECORE_VERSION=10.2.0-ltsc2019
HEADLESS_SERVICES_VERSION=20.0.1-20H2
MANAGEMENT_SERVICES_VERSION=4.2.1-20H2
TOOLS_VERSION=10.2-1809

SITECORE_ADMIN_PASSWORD=
SITECORE_ADMIN_PASSWORD=Password12345
SQL_SERVER=mssql
SQL_SA_LOGIN=sa
SQL_SA_PASSWORD=
SOLR_CORE_PREFIX_NAME=sitecore
TELERIK_ENCRYPTION_KEY=
Expand All @@ -38,3 +40,4 @@ TRAEFIK_IMAGE=traefik:v2.2.0-windowsservercore-1809
TRAEFIK_ISOLATION=hyperv
ISOLATION=default
MEDIA_REQUEST_PROTECTION_SHARED_SECRET=
MSSQL_PORT=14330
42 changes: 0 additions & 42 deletions examples/helix-basic-aspnetcore/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion examples/helix-basic-aspnetcore/docker/build/cd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ COPY --from=tooling C:\tools C:\tools
COPY --from=headless_services C:\module\cd\content C:\inetpub\wwwroot
COPY --from=headless_services C:\module\tools C:\module\tools
RUN C:\module\tools\Initialize-Content.ps1 -TargetPath C:\inetpub\wwwroot; `
Remove-Item -Path C:\module -Recurse -Force;
Remove-Item -Path C:\module -Recurse -Force;

# Copy solution website files
COPY --from=solution \artifacts\sitecore\ .\
2 changes: 1 addition & 1 deletion examples/helix-basic-aspnetcore/docker/build/cm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ COPY --from=management_services C:\module\cm\content C:\inetpub\wwwroot
COPY --from=headless_services C:\module\cm\content C:\inetpub\wwwroot
COPY --from=headless_services C:\module\tools C:\module\tools
RUN C:\module\tools\Initialize-Content.ps1 -TargetPath C:\inetpub\wwwroot; `
Remove-Item -Path C:\module -Recurse -Force;
Remove-Item -Path C:\module -Recurse -Force;

# Copy solution website files
COPY --from=solution \artifacts\sitecore\ .\
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ FROM ${BASE_IMAGE}
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Copy and init the JSS / Headless Services Module
COPY --from=headless_services C:\module\db C:\jss_data
RUN C:\DeployDatabases.ps1 -ResourcesDirectory C:\jss_data; `
Remove-Item -Path C:\jss_data -Recurse -Force;
COPY --from=headless_services C:\module\db C:\jss_data
5 changes: 5 additions & 0 deletions examples/helix-basic-aspnetcore/docker/build/prc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
14 changes: 14 additions & 0 deletions examples/helix-basic-aspnetcore/docker/build/rep/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# escape=`

ARG PARENT_IMAGE
ARG SOLUTION_IMAGE

FROM ${SOLUTION_IMAGE} as solution
FROM ${PARENT_IMAGE}

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

WORKDIR C:\inetpub\wwwroot

# Copy solution website files
COPY --from=solution \artifacts\website\ .\
52 changes: 52 additions & 0 deletions examples/helix-basic-aspnetcore/docker/build/solution/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# escape=`

# This Dockerfile will build the Sitecore solution and save the build artifacts for use in
# other images, such as 'cm' and 'rendering'. It does not produce a runnable image itself.

ARG BASE_IMAGE
ARG BUILD_IMAGE

# In a separate image (as to not affect layer cache), gather all NuGet-related solution assets, so that
# we have what we need to run a cached NuGet restore in the next layer:
# https://stackoverflow.com/questions/51372791/is-there-a-more-elegant-way-to-copy-specific-files-using-docker-copy-to-the-work/61332002#61332002
# This technique is described here:
# https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-3.1#the-dockerfile-1
FROM ${BUILD_IMAGE} AS nuget-prep
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

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 *.sln packages.config'

FROM ${BUILD_IMAGE} AS builder
ARG BUILD_CONFIGURATION
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Ensure updated nuget. Depending on your Windows version, dotnet/framework/sdk:4.8 tag may provide an outdated client.
# See https://github.com/microsoft/dotnet-framework-docker/blob/1c3dd6638c6b827b81ffb13386b924f6dcdee533/4.8/sdk/windowsservercore-ltsc2019/Dockerfile#L7
ENV NUGET_VERSION 5.8.1
RUN Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v$env:NUGET_VERSION/nuget.exe" -UseBasicParsing -OutFile "$env:ProgramFiles\NuGet\nuget.exe"

WORKDIR /build

# Copy prepped NuGet artifacts, and restore as distinct layer to take advantage of caching.
COPY --from=nuget-prep ./nuget ./

# Restore Platform NuGet packages
RUN nuget restore -Verbosity quiet

# Copy remaining source code
COPY src/ ./src/

# Build the Sitecore main platform artifacts
RUN msbuild .\src\Environment\platform\BasicCompany.Environment.Platform.csproj /p:Configuration=$env:BUILD_CONFIGURATION /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:PublishUrl=C:\out\sitecore

# Build the rendering host
WORKDIR C:\build\src\Project\BasicCompany\rendering\
RUN dotnet publish -c $env:BUILD_CONFIGURATION -o C:\out\rendering --no-restore

# Save the artifacts for copying into other images (see 'cm' and 'rendering' Dockerfiles).
FROM ${BASE_IMAGE}
WORKDIR /artifacts
COPY --from=builder C:/out/sitecore ./sitecore
COPY --from=builder C:/out/rendering ./rendering
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# escape=`

ARG PARENT_IMAGE

FROM ${PARENT_IMAGE}
33 changes: 33 additions & 0 deletions examples/helix-basic-aspnetcore/down.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[CmdletBinding(DefaultParameterSetName = "no-arguments")]
Param (
# use to run proper sitecore deployment setup
[string]$Topology
)

$topologyArray = "xp0", "xp1", "xm1";

$startDirectory = ".\run\sitecore-";
$workinDirectoryPath;
$envCheck;
$envCheckVariable = "HOST_LICENSE_FOLDER";

if ($topologyArray.Contains($Topology))
{
$envCheck = Get-Content (Join-Path -Path ($startDirectory + $Topology) -ChildPath .env) -Encoding UTF8 | Where-Object { $_ -imatch "^$envCheckVariable=.+" }
if ($envCheck) {
$workinDirectoryPath = $startDirectory + $Topology;
}
}

Push-Location $workinDirectoryPath

Write-Host "Down containers..." -ForegroundColor Green
try {
docker-compose down
if ($LASTEXITCODE -ne 0) {
Write-Error "Container down failed, see errors above."
}
}
finally {
Pop-Location
}
Loading