Docker
Integrate Onboardbase into your Docker
To use your Onboardbase in your docker environments, you have to install Onboardbase CLI during the image build process, and the credentials when running the container.
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
Installation
We recommend using npm/yarn for this process, below are examples of installations for different base docker images:
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
FROM node:14-alpine AS node
FROM alpine
COPY --from=node /usr/lib /usr/lib
COPY --from=node /usr/local/share /usr/local/share
COPY --from=node /usr/local/lib /usr/local/lib
COPY --from=node /usr/local/include /usr/local/include
COPY --from=node /usr/local/bin /usr/local/bin
RUN npm install -g @onboardbase/cli > dev/null && onboardbase -v
# Installs onboardbase
ENTRYPOINT ["onboardbase", "run", "-c"]
CMD ["env"] # Testing purposes only!
Notice that we have modified the ENTRYPOINT to use the onboardbase run
command, this makes it possible for your application start command to run within the context of Onboardbase secured environments.
Setup
To successfully run the built containers, token, project, and environment to fetch secrets from having to be provided as an environment arguments when running container.
For example, building the ubuntu image with the below command:
docker build -t your-application-image
And you can start the container with:
docker run -e ONBOARDBASE_TOKEN="$ONBOARDBASE_TOKEN" -e ONBOARDBASE_ENVIRONMENT=$ONBOARDBASE_ENVIRONMENT ONBOARDBASE_PROJECT=$ONBOARDBASE_PROJECT your-application-image
Updated 8 months ago