Created
October 18, 2023 01:37
-
-
Save briceburg/17ec78ba12ddb03fe6485d3cfc354625 to your computer and use it in GitHub Desktop.
bin/build - Docker Image building shell wrapper
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
#!/usr/bin/env bash | |
set -eo pipefail | |
project_root="$(cd "$(dirname "$0")/.." ; pwd -P)" | |
default_env="prod" | |
default_src="Dockerfile" | |
default_tag="build:latest" | |
( | |
echo "Build Dir: ${BUILD_DIR:=$project_root}" >&2 | |
echo "Build Env: ${BUILD_ENV:=$default_env}" >&2 | |
echo "Build Src: ${BUILD_SRC:=$default_src}" >&2 | |
echo "Build Tag: ${BUILD_TAG:=$default_tag}" >&2 | |
echo -e "\nBuilding...\n" >&2 | |
cd "$BUILD_DIR" | |
docker build -t "$BUILD_TAG" --target "$BUILD_ENV" -f "$BUILD_SRC" . \ | |
--secret id=GITHUB_TOKEN,env=GITHUB_TOKEN \ | |
--secret id=FOO,env=FOO | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment