Last active
March 15, 2022 13:59
-
-
Save lucasassisrosa/395226e86eea2c420951ea6e52da5aeb to your computer and use it in GitHub Desktop.
Docker Entrypoint sourcing .env file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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