diff --git a/README.md b/README.md index b232977..3c454ec 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ # mixtape-build-image -Docker container ready for building my mixtape. \ No newline at end of file +Docker container ready for building my mixtape. + +## Building + +``` +docker build . +``` + +Build and tag for release: + +``` +docker build -t git.0x45.cz/em/mixtape:$(date +%y%m%d) -t git.0x45.cz/em/mixtape:latest . +``` + +Using the included build script, which will also handle the publishing: + +``` +./build.sh +``` diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..2a54a46 --- /dev/null +++ b/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +logout() { + docker logout "$GIT_ADDRESS" +} + +trap logout EXIT + +GIT_ADDRESS="git.0x45.cz" +IMAGE_NAME="$GIT_ADDRESS/em/mixtape" +DATE_TAG=$(date +%y%m%d) + +docker build -t "${IMAGE_NAME}:${DATE_TAG}" -t "${IMAGE_NAME}:latest" . + +read -rp "Enter your ${GIT_ADDRESS} username: " USERNAME +read -rsp "Enter your ${GIT_ADDRESS} password: " PASSWORD +echo + +echo "$PASSWORD" | docker login -u "$USERNAME" "$GIT_ADDRESS" --password-stdin + +docker push "${IMAGE_NAME}:${DATE_TAG}" +docker push "${IMAGE_NAME}:latest"