mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-12-03 13:36:49 +01:00
467ecfdc99
- Added support for Quay.io - Added support for GHCR.io To enable support for these container image registries the following needs to be added. As `Actions secrets and variables` - `Secrets` - `DOCKERHUB_TOKEN` and `DOCKERHUB_USERNAME` - `QUAY_TOKEN` and `QUAY_USERNAME` As `Actions secrets and variables` - `Variables` - `Repository Variables` - `DOCKERHUB_REPO` - `GHCR_REPO` - `QUAY_REPO` The `DOCKERHUB_REPO` currently configured in `Secrets` can be removed if wanted, probably best after this PR has been merged. If one of the vars/secrets are not configured it will skip that specific registry!
51 lines
1.6 KiB
Bash
Executable file
51 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
echo ">>> Building images..."
|
|
|
|
# shellcheck source=arches.sh
|
|
source ./hooks/arches.sh
|
|
|
|
if [[ -z "${SOURCE_COMMIT}" ]]; then
|
|
# This var is typically predefined by Docker Hub, but it won't be
|
|
# when testing locally.
|
|
SOURCE_COMMIT="$(git rev-parse HEAD)"
|
|
fi
|
|
|
|
# Construct a version string in the style of `build.rs`.
|
|
GIT_EXACT_TAG="$(git describe --tags --abbrev=0 --exact-match 2>/dev/null)"
|
|
if [[ -n "${GIT_EXACT_TAG}" ]]; then
|
|
SOURCE_VERSION="${GIT_EXACT_TAG}"
|
|
else
|
|
GIT_LAST_TAG="$(git describe --tags --abbrev=0)"
|
|
SOURCE_VERSION="${GIT_LAST_TAG}-${SOURCE_COMMIT:0:8}"
|
|
fi
|
|
|
|
LABELS=(
|
|
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
|
|
org.opencontainers.image.created="$(date --utc --iso-8601=seconds)"
|
|
org.opencontainers.image.documentation="https://github.com/dani-garcia/vaultwarden/wiki"
|
|
org.opencontainers.image.licenses="AGPL-3.0-only"
|
|
org.opencontainers.image.revision="${SOURCE_COMMIT}"
|
|
org.opencontainers.image.source="${SOURCE_REPOSITORY_URL}"
|
|
org.opencontainers.image.url="https://github.com/dani-garcia/vaultwarden"
|
|
org.opencontainers.image.version="${SOURCE_VERSION}"
|
|
)
|
|
LABEL_ARGS=()
|
|
for label in "${LABELS[@]}"; do
|
|
LABEL_ARGS+=(--label "${label}")
|
|
done
|
|
|
|
# Check if DOCKER_BUILDKIT is set, if so, use the Dockerfile.buildkit as template
|
|
if [[ -n "${DOCKER_BUILDKIT}" ]]; then
|
|
buildkit_suffix=.buildkit
|
|
fi
|
|
|
|
set -ex
|
|
|
|
for arch in "${arches[@]}"; do
|
|
docker build \
|
|
"${LABEL_ARGS[@]}" \
|
|
-t "${DOCKER_REPO}:${DOCKER_TAG}-${arch}" \
|
|
-f "docker/${arch}/Dockerfile${buildkit_suffix}${distro_suffix}" \
|
|
.
|
|
done
|