2021-01-12 10:56:00 +00:00
|
|
|
#!/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 )"
|
2023-11-01 02:43:41 +00:00
|
|
|
cd "$REPO_DIR"
|
|
|
|
|
2024-06-03 08:13:17 +00:00
|
|
|
SUPPORTED_PLATFORMS="linux/amd64,linux/arm64" # no longer supported: linux/arm/v7
|
2023-11-01 02:43:41 +00:00
|
|
|
|
|
|
|
TAG_NAME="${1:-$(git rev-parse --abbrev-ref HEAD)}"
|
2021-01-12 10:56:00 +00:00
|
|
|
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
|
|
|
SHORT_VERSION="$(echo "$VERSION" | perl -pe 's/(\d+)\.(\d+)\.(\d+)/$1.$2/g')"
|
2023-12-18 05:48:38 +00:00
|
|
|
GIT_SHA=sha-"$(git rev-parse --short HEAD)"
|
2023-11-01 02:43:41 +00:00
|
|
|
SELECTED_PLATFORMS="${2:-$SUPPORTED_PLATFORMS}"
|
|
|
|
|
|
|
|
|
|
|
|
# echo "[*] Logging in to Docker Hub & Github Container Registry"
|
|
|
|
# docker login --username=nikisweeting
|
|
|
|
# docker login ghcr.io --username=pirate
|
2021-01-12 10:56:00 +00:00
|
|
|
|
2023-11-01 02:43:41 +00:00
|
|
|
echo "[^] Building docker image"
|
2023-12-18 05:51:04 +00:00
|
|
|
./bin/build_docker.sh "$TAG_NAME" "$SELECTED_PLATFORMS"
|
2021-01-12 10:56:00 +00:00
|
|
|
|
|
|
|
echo "[^] Uploading docker image"
|
2023-11-01 02:43:41 +00:00
|
|
|
docker buildx build --platform "$SELECTED_PLATFORMS" --push . \
|
|
|
|
-t archivebox/archivebox:$TAG_NAME \
|
2023-12-18 05:48:38 +00:00
|
|
|
-t archivebox/archivebox:$GIT_SHA \
|
2023-11-01 02:43:41 +00:00
|
|
|
-t nikisweeting/archivebox:$TAG_NAME \
|
2023-12-18 05:48:38 +00:00
|
|
|
-t nikisweeting/archivebox:$GIT_SHA \
|
2023-11-01 02:43:41 +00:00
|
|
|
-t ghcr.io/archivebox/archivebox/archivebox:$TAG_NAME \
|
2023-12-18 05:48:38 +00:00
|
|
|
-t ghcr.io/archivebox/archivebox/archivebox:$GIT_SHA
|
2024-06-03 08:13:17 +00:00
|
|
|
# -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/archivebox:$VERSION \
|
|
|
|
# -t ghcr.io/archivebox/archivebox/archivebox:$SHORT_VERSION \
|
2023-12-18 05:48:38 +00:00
|
|
|
|