Skip to content

Instantly share code, notes, and snippets.

@cassidydotdk
Last active September 27, 2019 19:22
Show Gist options
  • Save cassidydotdk/47eacabd752d7a84e7e5826531fb0f9e to your computer and use it in GitHub Desktop.
Save cassidydotdk/47eacabd752d7a84e7e5826531fb0f9e to your computer and use it in GitHub Desktop.
How to configure Unicorn with a volume mapping for your CM server Docker container
cm:
image: sitecore-xp-sxa-1.9.0-standalone:9.2.0-windowsservercore-${WINDOWSSERVERCORE_CHANNEL}
entrypoint: cmd /c "start /B powershell Watch-Directory C:/src C:/inetpub/sc & C:\\remote_debugger\\x64\\msvsmon.exe /noauth /anyuser /silent /nostatus /noclrwarn /nosecuritywarn /nofirewallwarn /nowowwarn /timeout:2147483646"
volumes:
- C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Remote Debugger:C:\remote_debugger:ro
- .\deploy:C:\src
- .\unicorn:C:\unicorn
- .\data\cm:C:\inetpub\sc\App_Data\logs
- .\data\creativeexchange:C:\inetpub\sc\App_Data\packages\CreativeExchange\FileStorage
ports:
- "44001:80"
links:
- sql
- solr
- xconnect
Only this part is relevant to Unicorn. It will map your solutionroot/unicorn to C:\unicorn in the container
volumes:
- .\unicorn:C:\unicorn
How to set up Unicorn in your Docker container
Since all writing to Unicorn files happens inside the container, and the container is now linked to .\unicorn,
all you need to do is ensure that .\unicorn is included under source control.
This gets even better if you use Transparent Sync.
Place this in App_Config/Include/z.Unicorn
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<unicorn>
<defaults>
<targetDataStore>
<patch:attribute name="physicalRootPath">c:\unicorn\$(configurationName)</patch:attribute>
</targetDataStore>
</defaults>
</unicorn>
</sitecore>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment