Skip to content

Instantly share code, notes, and snippets.

@lucasassisrosa
Last active March 15, 2022 13:59
Show Gist options
  • Save lucasassisrosa/395226e86eea2c420951ea6e52da5aeb to your computer and use it in GitHub Desktop.
Save lucasassisrosa/395226e86eea2c420951ea6e52da5aeb to your computer and use it in GitHub Desktop.
Docker Entrypoint sourcing .env file
#!/bin/sh
# source secrets and/or constants. This will export envs and populate process.env for Node in runtime
set -o allexport
SECRETS_FILE="/ci_folder/service.env"
set +o allexport
if [ -f "$SECRETS_FILE" ]; then
set -a
source "$SECRETS_FILE"
export CMS_HOST=${CMS_HOST}
export CMS_ACCESS_TOKEN=${CMS_ACCESS_TOKEN}
export GOOGLE_API_KEY=${GOOGLE_API_KEY}
export NODE_ENV=${NODE_ENV}
export PORT=${PORT}
export RUNTIME_ENV=${RUNTIME_ENV}
set +a
else
echo "$SECRETS_FILE Not Found"
fi
yarn start -p ${PORT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment