Commit ebaeb60c authored by Cooper, Caleb's avatar Cooper, Caleb
Browse files

Update rse-bash-modules.sh

parent 4d6ea7e5
......@@ -23,10 +23,11 @@ func_rse_docker_cleanup() {
}
func_rse_docker_build_push() {
while getopts ":t:f:" opt; do
while getopts ":t:f:e:" opt; do
case ${opt} in
t) TAG="/${OPTARG}";;
f) FILE="${OPTARG}";;
e) ENV_FILE="${OPTARG}";;
esac
done
COMMIT_REF=$(echo "$CI_COMMIT_REF_NAME" | tr '[:upper:]' '[:lower:]' | tr '/' '_' | sed -e 's/^master$/latest/')
......@@ -35,7 +36,11 @@ func_rse_docker_build_push() {
else
COMMIT_REF="/${COMMIT_REF}"
fi
docker build -f "${FILE}" -t ${CI_REGISTRY,,}/${CI_PROJECT_PATH,,}${TAG,,}${COMMIT_REF,,} .
if [[ -f ${ENV_FILE} ]]; then
docker build -e "${ENV_FILE}" -f "${FILE}" -t ${CI_REGISTRY,,}/${CI_PROJECT_PATH,,}${TAG,,}${COMMIT_REF,,} .
else
docker build -f "${FILE}" -t ${CI_REGISTRY,,}/${CI_PROJECT_PATH,,}${TAG,,}${COMMIT_REF,,} .
fi
docker login --username=$CI_REGISTRY_USER --password=$CI_REGISTRY_PASSWORD $CI_REGISTRY
docker push ${CI_REGISTRY,,}/${CI_PROJECT_PATH,,}${TAG,,}${COMMIT_REF,,}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment