Docker Compose
Integrate Onboardbase into your Docker Compose
TIP
You can authenticate the CLI with Environment variables.
Supported environment variables are:
ONBOARDBASE_TOKEN
- A service tokenONBOARDBASE_PROJECT
- an onboardbase project nameONBOARDBASE_ENVIRONMENT
- an environment in the specified project
Docker compose services can be set up to read Onboardbase secrets through Dockerfile
and docker-compose.yml
Installation
Below is a dockerfile
that installs Onboardbase and copies the setup file from the project directory to the container's application directory.
FROM ubuntu
# Installs onboardbase
RUN apt-get update > /dev/null && apt-get install -y curl build-essential > dev/null && curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh > dev/null && bash nodesource_setup.sh && apt install nodejs && npm install -g @onboardbase/cli > dev/null && onboardbase -v
ENTRYPOINT ["onboardbase", "run", "-c"]
CMD ["env"] # Replace with your start CMD
Next, we will have a docker-compose file that reads Onboardbase from the host environment variables.
services:
server:
build: .
container_name: onboardbase-ubuntu
init: true
environment:
- ONBOARDBASE_TOKEN
- ONBOARDBASE_PROJECT
- ONBOARDBSE_ENVIRONMENT
Next, we set the environment variables for all the variables
export ONBOARDBASE_TOKEN="Service.******"
export ONBOARDBASE_PROJECT="test-project"
export ONBOARDBSE_ENVIRONMENT="test-environment"
Finally, start the services with:
docker-compose up
Setup file
In the case that you have a setup file available in the project root(this file is not tracked by git), you can have a copy command in your Dockerfile that copies .onboardbase.yaml
into the container.
FROM ubuntu
# Installs onboardbase
RUN apt-get update > /dev/null && apt-get install -y curl build-essential > dev/null && curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh > dev/null && bash nodesource_setup.sh && apt install nodejs && npm install -g @onboardbase/cli > dev/null && onboardbase -v
COPY ./onboardbase.yaml ./onboardbase.yaml
ENTRYPOINT ["onboardbase", "run", "-c"]
CMD ["env"] # Replace with your start CMD
And your docker-compose file would require ONBOARDBASE_TOKEN
services:
server:
build: .
container_name: onboardbase-ubuntu
init: true
environment:
- ONBOARDBASE_TOKEN
Finally, start the services:
docker-compose up
Updated 8 months ago