Dockerizing brX GraphQL Service

This Bloomreach Experience Manager feature requires a standard or premium license. Please contact Bloomreach for more information.

Introduction

The brX GraphQL Service project includes an example Dockerfile and docker-compose.yml file for Docker-based software packaging, deployment, and managing scalable containers. These examples can be used as-is or customized for your own requirements.

Default Example Dockerfile

The default example Dockerfile looks as follows:

FROM node:alpine

COPY . /app
WORKDIR /app

RUN npm install && npm run build

EXPOSE 4000

ENTRYPOINT ["npm", "run"]
CMD ["start"]

You can customize the script (e.g, port number to expose) if necessary.

You can build a Docker image of the brX GraphQL Service as follows:

docker build -t bloomreach/brx-apollo-server:latest .

The above command will build a Docker image with the tag, "bloomreach/brx-apollo-server:latest", for example.

You can run the Docker image like the following example, publishing a container’s port, 4000, to the host's port, 4000:

docker run -p4000:4000 bloomreach/brx-apollo-server:latest
Find more instructions in Docker documentation site.

Default Example Docker Composition

The default example docker-compose.yml looks as follows:

version: '3.7'

services:
  graphql-commerce-connector-service:
    build:
      context: .
    container_name: graphql-commerce-connector-service
    image: bloomreach/graphql-commerce-connector-service:latest
    ports:
      - '4000:4000'
    environment:
      NODE_ENV=production
      APOLLO_INTROSPECTION=false
      APOLLO_PLAYGROUND=false
      LOG_LEVEL=info
      BRSM_API=https://core.dxpapi.com/api
      BRSM_SUGGEST_API=https://suggest.dxpapi.com/api
      BRSM_ACCOUNT_ID=0000
      BRSM_DOMAIN_KEY=mydomain
      JWK_KEYSTORE={...}
      # ...SNIP...

You can customize the script (e.g, port number to expose, environment variables, etc.) if necessary.

You can build images as follows:

docker-compose build

You can also build and run the images as follows:

docker-compose up
You can include more service(s) in the docker-compose.yml to compose multiple containers in the services section of the file. For exmple, if necessary, you can add a new service for your SPA project to build and deploy the sevices together.
Find more instructions in Docker Compose documentation site.
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?