Since Sitecore released support for Docker with their version of Sitecore 10, this will be the perfect time to test out the Headless SSR Proxy.
I have blogged about a week ago about how to get started with Sitecore Docker and Sitecore JSS
With Docker support it is super fast to test things out. One of the main and biggest reasons to use Sitecore JSS is because you can build headless applications. Here I created a JSS app and SSR proxy for it. For an easier testing of this solution I have created a docker image that all you have to do is pull it and run it 🙂
First you will need to deploy your JSS app to Sitecore and then you can just run your SSR Proxy against it.
I have prepared quick installation instructions for you, to get started with it fast.
Step 1: Clone Repo and Deploy it your Sitecore Instance
git clone https://github.com/tmamedbekov/jss-personalization.git
I assume you have Sitecore running with Sitecore JSS installed, so go ahead and run the following command from your terminal from within the repo folder that you just cloned
jss deploy app
Step 2: Pull the Docker Image (optional)
I assume you have Docker Installed and Docker is running (https://www.docker.com/get-started)
docker pull tmamedbekov/headless-sitecore
Step 3: Run the Docker Container from the Image that you just pulled:
docker run -p 5000:5000 -d tmamedbekov/headless-sitecore
All the references:
https://github.com/tmamedbekov/jss-personalization
https://hub.docker.com/r/tmamedbekov/headless-sitecore
Now let me explain to you how I got all of this working:
Create a Dockerfile, that will run NODEJS
FROM node:12
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
EXPOSE 5000
CMD [ "node", "index.js" ]
Then copy all your SSR Proxy “dist” folder from your JSS solution into the same folder and build the docker image.
If you have any questions, leave a comment below or reach to me on Twitter or Slack.
One thought on “Headless SSR Proxy with Sitecore JSS and Docker”