Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
Rework build script to support publishing too
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Oct 10, 2021
1 parent 997317d commit c6e35b5
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions build.sh
@@ -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

0 comments on commit c6e35b5

Please sign in to comment.