This repo contains utility scripts that help writing containerized apps.
- load-env-vars.sh: Processes the below required environment variables to set up git and Slack operations. Load this file (via source) and then load slack.sh.
- slack.sh: Defines two Slack communication functions:
slack_message()
: Post a message to the passed Slack channel.slack_upload()
: Upload a file to the passed Slack channel.
load-env-vars.sh requires the following environment variables.
Note It's easiest and safest to save these in a
*.env
file and then pass that file todocker run
.
SLACK_API_TOKEN
,CHANNEL_ID
: API token for the lab's slack API and the Slack channel id to send messages to, respectively. Saved into~/.env
.GH_TOKEN
: GitHub personal access token that the GitHub CLI will use. Saved into~/.env
.GIT_USER_NAME
,GIT_USER_EMAIL
: Globaluser.name
anduser.email
values to save into the~/.gitconfig
Configuration variables file viagit config --global ...
.GIT_CREDENTIALS
: GitHub personal access token as used by git-credential-store. Saved into~/.git-credentials
.
Most lab scripts support a DRY_RUN
environment variable that's used during development. Typically, the scripts check for that variable being set and, if so, exit before performing any permanent changes such as git operations. This allows running a script locally through the call to the actual model being containerized so that output(s) can be examined.
Other than standard Linux commands and bash
, the scripts here only require one additional binary: https://jqlang.org/ .