Skip to content

Commit

Permalink
Merge pull request #15 from Sitecore/develop
Browse files Browse the repository at this point in the history
Merge in new Docker Examples content
  • Loading branch information
bplasmeijer committed Aug 4, 2020
2 parents 19caa75 + e3a108a commit 2b96582
Show file tree
Hide file tree
Showing 168 changed files with 2,999 additions and 5,955 deletions.
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Ignore thumbnails created by Windows
Thumbs.db
# Ignore files built by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.zip
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
.vs/
.vscode/
packages/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Sitecore
Copyright (c) 2020 Sitecore

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# docker-demo
This is a repository where people can contribute examples, ideas and how-tos on how to use Sitecore Docker Images which are created in the [docker-images](https://github.com/sitecore/docker-images) "sister" repository.
# Sitecore Docker Examples

This repository contains companion code for the [Sitecore Containers documentation](https://containers.doc.sitecore.com/). Together, these are meant to help you get started using [Docker](https://www.docker.com/) containers with Sitecore.

Briefly, here's what you'll find in this repo:

* Example for running an out of the box Sitecore instance (see `getting-started`).
* Example solution for creating custom Sitecore images, with recommended folder structure for container development (see `custom-images`).
* Sample PowerShell scripts for container-based Sitecore instance preparation (`init.ps1`) and cleanup (`clean.ps1`).
* Docker compose files for building Sitecore instances in various topologies (see `custom-images`).

Please refer to the [Sitecore Containers documentation](https://containers.doc.sitecore.com/) for complete details, including running the examples and recommended usage.

## Are Docker Examples supported by Sitecore?

Sitecore maintains the Sitecore Containers documentation and Docker Examples, but example code is not supported by Sitecore Product Support Services. Please do not submit support tickets regarding Docker Examples.

## How can I get help with Docker Examples?

Start with the [Sitecore Containers documentation](https://containers.doc.sitecore.com/). For technical issues in particular, check out the [Troubleshooting guide](https://containers.doc.sitecore.com/docs/troubleshooting).

Beyond that, for usage questions regarding Docker Examples installation or code, or general questions about Sitecore Containers, please utilize [Sitecore Stackexchange](https://sitecore.stackexchange.com/) or [#docker](https://sitecorechat.slack.com/messages/docker) on [Sitecore Community Slack](https://sitecore.chat/).

You can use GitHub to submit [issues](https://github.com/Sitecore/docker-examples/issues/new) for Docker Examples, but please do not submit usage questions.
17 changes: 17 additions & 0 deletions custom-images/.dockerignore
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
34 changes: 34 additions & 0 deletions custom-images/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
COMPOSE_PROJECT_NAME=docker-examples
REGISTRY=
VERSION=

SOLUTION_BUILD_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8
SOLUTION_BASE_IMAGE=mcr.microsoft.com/windows/nanoserver:1809
BUILD_CONFIGURATION=debug

LOCAL_DEPLOY_PATH=.\docker\deploy
LOCAL_DATA_PATH=.\docker\data

CD_HOST=cd.dockerexamples.localhost
CM_HOST=cm.dockerexamples.localhost
ID_HOST=id.dockerexamples.localhost

SITECORE_DOCKER_REGISTRY=scr.sitecore.com/sxp/
SITECORE_TOOLS_REGISTRY=scr.sitecore.com/tools/
SITECORE_MODULE_REGISTRY=scr.sitecore.com/sxp/modules/
SITECORE_VERSION=10.0.0-ltsc2019
TOOLS_VERSION=10.0.0-1809
SPE_VERSION=6.1.1-1809
SXA_VERSION=10.0.0-1809

SITECORE_ADMIN_PASSWORD=
SQL_SA_PASSWORD=
REPORTING_API_KEY=
TELERIK_ENCRYPTION_KEY=
SITECORE_IDSECRET=
SITECORE_ID_CERTIFICATE=
SITECORE_ID_CERTIFICATE_PASSWORD=
SITECORE_LICENSE=
TRAEFIK_IMAGE=traefik:v2.2.0-windowsservercore-1809
TRAEFIK_ISOLATION=hyperv
ISOLATION=default
3 changes: 3 additions & 0 deletions custom-images/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.0.46" />
</Project>
55 changes: 55 additions & 0 deletions custom-images/DockerExamples.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30002.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockerExamples.Website", "src\DockerExamples.Website\DockerExamples.Website.csproj", "{B062D0AC-C7AB-448A-AB55-0791E7AC974A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockerExamples.XConnect", "src\DockerExamples.XConnect\DockerExamples.XConnect.csproj", "{5A9AB6CC-9800-4725-9967-16A58123D394}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockerExamples.XConnect.Model", "src\DockerExamples.XConnect.Model\DockerExamples.XConnect.Model.csproj", "{16DC2062-E853-44BB-A006-BC1F4CD5BBCF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App.XConnect.ModelBuilder", "src\App.XConnect.ModelBuilder\App.XConnect.ModelBuilder.csproj", "{C6144D27-3F34-4761-B040-CB9E8C56955E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".app", ".app", "{D9AF16A6-F9A5-4E42-A37B-A440E8CEACC5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App.XConnect.Demo", "src\App.XConnect.Demo\App.XConnect.Demo.csproj", "{2FF4ECD0-C43F-4BE2-A261-C386EFFD335E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B062D0AC-C7AB-448A-AB55-0791E7AC974A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B062D0AC-C7AB-448A-AB55-0791E7AC974A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B062D0AC-C7AB-448A-AB55-0791E7AC974A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B062D0AC-C7AB-448A-AB55-0791E7AC974A}.Release|Any CPU.Build.0 = Release|Any CPU
{5A9AB6CC-9800-4725-9967-16A58123D394}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A9AB6CC-9800-4725-9967-16A58123D394}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A9AB6CC-9800-4725-9967-16A58123D394}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A9AB6CC-9800-4725-9967-16A58123D394}.Release|Any CPU.Build.0 = Release|Any CPU
{16DC2062-E853-44BB-A006-BC1F4CD5BBCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16DC2062-E853-44BB-A006-BC1F4CD5BBCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16DC2062-E853-44BB-A006-BC1F4CD5BBCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16DC2062-E853-44BB-A006-BC1F4CD5BBCF}.Release|Any CPU.Build.0 = Release|Any CPU
{C6144D27-3F34-4761-B040-CB9E8C56955E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6144D27-3F34-4761-B040-CB9E8C56955E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6144D27-3F34-4761-B040-CB9E8C56955E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6144D27-3F34-4761-B040-CB9E8C56955E}.Release|Any CPU.Build.0 = Release|Any CPU
{2FF4ECD0-C43F-4BE2-A261-C386EFFD335E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FF4ECD0-C43F-4BE2-A261-C386EFFD335E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FF4ECD0-C43F-4BE2-A261-C386EFFD335E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FF4ECD0-C43F-4BE2-A261-C386EFFD335E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C6144D27-3F34-4761-B040-CB9E8C56955E} = {D9AF16A6-F9A5-4E42-A37B-A440E8CEACC5}
{2FF4ECD0-C43F-4BE2-A261-C386EFFD335E} = {D9AF16A6-F9A5-4E42-A37B-A440E8CEACC5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {44094B79-5407-4492-B8D1-B0EA37325E6E}
EndGlobalSection
EndGlobal
45 changes: 45 additions & 0 deletions custom-images/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# escape=`

ARG BASE_IMAGE
ARG BUILD_IMAGE

FROM ${BUILD_IMAGE} AS prep

# 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

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\DockerExamples.Website\DockerExamples.Website.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\
12 changes: 12 additions & 0 deletions custom-images/Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PlatformVersion>10.0.0</PlatformVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Update="Sitecore.XConnect" Version="$(PlatformVersion)" />
<PackageReference Update="Sitecore.XConnect.Client" Version="$(PlatformVersion)" />
<PackageReference Update="Sitecore.XConnect.Collection.Model" Version="$(PlatformVersion)" />
<PackageReference Update="Sitecore.Assemblies.XConnect.Web" Version="$(PlatformVersion)" />
</ItemGroup>
</Project>
108 changes: 108 additions & 0 deletions custom-images/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
version: "2.4"

services:

solution:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
build:
context: .
args:
BASE_IMAGE: ${SOLUTION_BASE_IMAGE}
BUILD_IMAGE: ${SOLUTION_BUILD_IMAGE}
BUILD_CONFIGURATION: ${BUILD_CONFIGURATION}
scale: 0

traefik:
volumes:
- ./docker/traefik:C:/etc/traefik

mssql:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-mssql:${VERSION:-latest}
build:
context: ./docker/build/mssql
args:
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-mssql:${SITECORE_VERSION}
SPE_IMAGE: ${SITECORE_MODULE_REGISTRY}spe-assets:${SPE_VERSION}
SXA_IMAGE: ${SITECORE_MODULE_REGISTRY}sxa-xp1-assets:${SXA_VERSION}
mem_limit: 2GB
volumes:
- ${LOCAL_DATA_PATH}\mssql:c:\data

solr:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-solr:${VERSION:-latest}
build:
context: ./docker/build/solr
args:
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-solr:${SITECORE_VERSION}
SXA_IMAGE: ${SITECORE_MODULE_REGISTRY}sxa-xp1-assets:${SXA_VERSION}
mem_limit: 1GB
volumes:
- ${LOCAL_DATA_PATH}\solr:c:\data

id:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-id:${VERSION:-latest}
build:
context: ./docker/build/id
args:
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-id:${SITECORE_VERSION}

cm:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-cm:${VERSION:-latest}
build:
context: ./docker/build/cm
args:
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cm:${SITECORE_VERSION}
SPE_IMAGE: ${SITECORE_MODULE_REGISTRY}spe-assets:${SPE_VERSION}
SXA_IMAGE: ${SITECORE_MODULE_REGISTRY}sxa-xp1-assets:${SXA_VERSION}
TOOLING_IMAGE: ${SITECORE_TOOLS_REGISTRY}sitecore-docker-tools-assets:${TOOLS_VERSION}
SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
depends_on:
- solution
volumes:
- ${LOCAL_DEPLOY_PATH}\website:C:\deploy
- ${LOCAL_DATA_PATH}\cm:C:\inetpub\wwwroot\App_Data\logs
entrypoint: powershell -Command "& C:\tools\entrypoints\iis\Development.ps1"

xconnect:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-xconnect:${VERSION:-latest}
build:
context: ./docker/build/xconnect
args:
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-xconnect:${SITECORE_VERSION}
TOOLING_IMAGE: ${SITECORE_TOOLS_REGISTRY}sitecore-docker-tools-assets:${TOOLS_VERSION}
SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
depends_on:
- solution
volumes:
- ${LOCAL_DEPLOY_PATH}\xconnect:C:\deploy
entrypoint: powershell -Command "& C:\tools\entrypoints\iis\Development.ps1"

xdbsearchworker:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-xdbsearchworker:${VERSION:-latest}
build:
context: ./docker/build/xdbsearchworker
args:
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-xdbsearchworker:${SITECORE_VERSION}
SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
depends_on:
- solution

xdbautomationworker:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-xdbautomationworker:${VERSION:-latest}
build:
context: ./docker/build/xdbautomationworker
args:
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-xdbautomationworker:${SITECORE_VERSION}
SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
depends_on:
- solution

cortexprocessingworker:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-cortexprocessingworker:${VERSION:-latest}
build:
context: ./docker/build/cortexprocessingworker
args:
BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cortexprocessingworker:${SITECORE_VERSION}
SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
depends_on:
- solution
Loading

0 comments on commit 2b96582

Please sign in to comment.