Dockerizing brX GraphQL Service
Info: This feature in Bloomreach Content requires a standard or premium license. Contact Bloomreach for details.
Overview
The brX GraphQL Service project provides example Dockerfile and docker-compose.yml files for packaging and deploying the service using Docker. You can use these examples directly or modify them to fit your deployment requirements.
Example Dockerfile
The following is the default example Dockerfile:
FROM node:alpine
COPY . /app
WORKDIR /app
RUN npm install && npm run build
EXPOSE 4000
ENTRYPOINT ["npm", "run"]
CMD ["start"]
Adjust the configuration as needed, such as changing the exposed port.
To build a Docker image for the brX GraphQL Service, run:
docker build -t bloomreach/brx-apollo-server:latest .
This command creates a Docker image tagged as bloomreach/brx-apollo-server:latest.
To start a container and map port 4000 from the container to the host, use:
docker run -p4000:4000 bloomreach/brx-apollo-server:latest
Info: For additional details, refer to the Docker documentation.
Example Docker Compose Configuration
The default example docker-compose.yml is 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...
Modify this file as needed, such as changing ports or environment variables.
To build the images defined in the composition, run:
docker-compose build
To build and start the containers, run:
docker-compose up
Hint: You can add more services to the
docker-compose.ymlfile by defining them in the services section. For example, you can add a service for your SPA project to build and deploy multiple containers together.
For more information, see the Docker Compose documentation.