ArchiveBox/bin/release_docker.sh
Nick Sweeting ba14ee0e5e
Some checks failed
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Has been cancelled
Build Debian package / build (push) Has been cancelled
Build Docker image / buildx (push) Has been cancelled
Build Homebrew package / build (push) Has been cancelled
Build GitHub Pages website / build (push) Has been cancelled
Run linters / lint (push) Has been cancelled
Build Pip package / build (push) Has been cancelled
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Has been cancelled
Run tests / docker_tests (push) Has been cancelled
Build GitHub Pages website / deploy (push) Has been cancelled
fix ghcr image names
2024-06-04 04:17:33 -07:00

50 lines
1.9 KiB
Bash
Executable file

#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
IFS=$'\n'
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
cd "$REPO_DIR"
SUPPORTED_PLATFORMS="linux/amd64,linux/arm64" # no longer supported: linux/arm/v7
TAG_NAME="${1:-$(git rev-parse --abbrev-ref HEAD)}"
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
SHORT_VERSION="$(echo "$VERSION" | perl -pe 's/(\d+)\.(\d+)\.(\d+)/$1.$2/g')"
GIT_SHA=sha-"$(git rev-parse --short HEAD)"
SELECTED_PLATFORMS="${2:-$SUPPORTED_PLATFORMS}"
# echo "[*] Logging in to Docker Hub & Github Container Registry"
# docker login --username=nikisweeting
# docker login ghcr.io --username=pirate
echo "[^] Building docker image"
./bin/build_docker.sh "$TAG_NAME" "$SELECTED_PLATFORMS"
echo "[^] Uploading docker image"
docker buildx build --platform "$SELECTED_PLATFORMS" --push . \
-t archivebox/archivebox:$TAG_NAME \
-t archivebox/archivebox:$GIT_SHA \
-t nikisweeting/archivebox:$TAG_NAME \
-t nikisweeting/archivebox:$GIT_SHA \
-t ghcr.io/archivebox/archivebox:$TAG_NAME \
-t ghcr.io/archivebox/archivebox:$GIT_SHA
# -t archivebox/archivebox \
# -t archivebox/archivebox:$VERSION \
# -t archivebox/archivebox:$SHORT_VERSION \
# -t archivebox/archivebox:latest \
# -t nikisweeting/archivebox \
# -t nikisweeting/archivebox:$VERSION \
# -t nikisweeting/archivebox:$SHORT_VERSION \
# -t nikisweeting/archivebox:latest \
# -t ghcr.io/archivebox/archivebox:$VERSION \
# -t ghcr.io/archivebox/archivebox:$SHORT_VERSION \