This repository has been archived by the owner on Aug 27, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework build script to support publishing too
- Loading branch information
Showing
1 changed file
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
#!/bin/bash | ||
set -e | ||
set -e -o pipefail | ||
|
||
# Helper for building the images locally | ||
|
||
branch="$1" | ||
if [ -z "$branch" ]; then | ||
branch="$(git branch --no-color | grep \* | cut -d ' ' -f2)" | ||
fi | ||
./cp-static.sh | ||
tag=$(git describe --tags) | ||
echo "Building $tag" | ||
|
||
for base in alpine baseimage; do | ||
cd "py3-$base" | ||
docker build . -t "stevearc/pypicloud:$branch-$base" -t "stevearc/pypicloud:local-$base" | ||
cd .. | ||
done | ||
docker build --pull py3-baseimage -t "stevearc/pypicloud:latest" -t "stevearc/pypicloud:$tag" | ||
docker build --pull py3-alpine -t "stevearc/pypicloud:latest-alpine" -t "stevearc/pypicloud:$tag-alpine" | ||
|
||
if [ "$1" == '--publish' ]; then | ||
if [ -n "$(git status --porcelain)" ]; then | ||
git status | ||
echo "" | ||
echo "Repo is not clean. Refusing to publish." | ||
exit 1 | ||
fi | ||
git describe --tags --exact-match | ||
docker push "stevearc/pypicloud:latest" | ||
docker push "stevearc/pypicloud:$tag" | ||
docker push "stevearc/pypicloud:latest-alpine" | ||
docker push "stevearc/pypicloud:$tag-alpine" | ||
fi |