mirror of
https://github.com/kennethreitz/bake.git
synced 2026-06-05 23:00:17 +00:00
64 lines
1.4 KiB
Plaintext
64 lines
1.4 KiB
Plaintext
|
|
REGISTRY=${REGISTRY:-docker.pkg.github.com}
|
|
USERNAME=${USERNAME:-kennethreitz}
|
|
|
|
install: install/system install/python
|
|
|
|
install/python: install/system @skip:key=./Pipfile.lock
|
|
pipenv install
|
|
|
|
install/system:
|
|
lazy_brew pipenv
|
|
|
|
docker/test: docker/build
|
|
docker-compose run --entrypoint bash bake -c 'set -ex && pip3 install pytest && pytest'
|
|
|
|
docker/release: docker/build/full docker/release/github
|
|
docker-compose push
|
|
|
|
docker/release/github: docker/build/full
|
|
set -ux
|
|
|
|
declare -a IMAGES=('bake:core' 'bake:latest')
|
|
|
|
for IMAGE in "${IMAGES[@]}"; do
|
|
REMOTE_IMAGE="$REGISTRY/$USERNAME/bake/$IMAGE"
|
|
|
|
# Tag the images for GitHub Registry.
|
|
docker tag "$USERNAME/$IMAGE" "$REMOTE_IMAGE"
|
|
|
|
# Push the images to GitHub.
|
|
docker push "$REMOTE_IMAGE"
|
|
done
|
|
|
|
docker/build:
|
|
# Build the images.
|
|
set -ex && docker-compose build
|
|
|
|
docker/build/full:
|
|
# Build the images.
|
|
set -ex && docker-compose build --no-cache
|
|
|
|
random/python:
|
|
#!/usr/bin/env python
|
|
import site
|
|
print(site)
|
|
|
|
|
|
|
|
lazy_brew() {
|
|
set -e
|
|
# Install jq if it's not available.
|
|
|
|
if ! which jq > /dev/null; then
|
|
set -ex && brew install jq
|
|
fi
|
|
|
|
# Install requested packages, if they aren't installed.
|
|
for PACKAGE in "$@"; do
|
|
if ! brew info --installed --json | jq 'map(.name) | index( "$PACKAGE" )' > /dev/null; then
|
|
set -ex && brew install "$PACKAGE" > /dev/null
|
|
fi
|
|
done
|
|
}
|