Saturday, 17 March 2018

RUN SDL DXA inside Windows Docker Container

In one of my previous blog post, we learned, How to run SDL DXA theming inside Docker. Today we are going to run SDL DXA in Window Docker. It is really quick and easy. To learn more about my previous blog post click here.

Steps to setup you SDL DXA-WEBAPP in Docker

  1. Download DXA latest version from SDL GITHUB account.
  2. Create a folder at any location, this path will be used as a physical location when you run the web-install.ps1.
  3. Go to the Root directory and create Dockerfile.
  4. Here, it is very important to understand that what all you need to have in your DockerFile. I faced couple of issues while I was working on this but managed to solve all of them.
  5. Once your SDL DXA is installed copy and paste below sample Dockerfile content in your file.
  6.  FROM microsoft/aspnet  
     RUN New-Item c:\sdldxaindocker -type directory  
     WORKDIR /sdldxaindocker  
     COPY ./DXADOCKER/ .  
     RUN Remove-WebSite -Name 'Default Web Site'   
     RUN New-Website -Name 'DXADOCKER' -Port 80 -PhysicalPath 'c:\sdldxaindocker'  -ApplicationPool '.NET v4.5'  
    
  7. Open PowerShell in Admin mode and navigate to root directory created in step 2.
  8. Run the following Docker commands.
    • docker build -t sdldxaindocker .     (refer ScreenShot 1)
    • docker run -d --name sdldxaindockerimage sdldxaindocker  (refer Screenshot 2)
    • docker inspect -f  "{{ NetworkSettings.Networks.nat.IPAddress }}" sdldxaindockerimage  (refer ScreenShot 3)
  9. Last step set-TtmWebsite and update the -BaseUrls
Advantages of using Docker.
  1. You can connect your source code with docker and with this it will keep your code in-sync/updated with your Docker container and solve your CI problems.
  2. You can run this container on any platform.
  3. Automate your build and test pipelines and accelerate your software development.
  4. Minimum Infrastructure.
  5. Load-Balancing can be managed easily.
  6. Improve Efficiency of DevOps.
  7. Easy Distribution, share, and configuration of applications.
  8. Easy and real-time scaling of application 

The output of your Docker commands.

ScreenShot 1
ScreenShot 2
Screenshot 3

Browse the URL http://172.24.179.102/




Happy coding and keep sharing !!!!

No comments:

Post a Comment