42 lines
999 B
Bash
Executable File
42 lines
999 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
REGISTRY="${READABOOK_REGISTRY:-gitea.anthonybouteiller.ovh/blomios/readabook}"
|
|
TAG="${READABOOK_TAG:-latest}"
|
|
REVISION="${OCI_IMAGE_REVISION:-$(git rev-parse HEAD)}"
|
|
CREATED="${OCI_IMAGE_CREATED:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}"
|
|
PLATFORM="${DOCKER_BUILD_PLATFORM:-}"
|
|
|
|
build_args=(
|
|
--build-arg "OCI_IMAGE_CREATED=${CREATED}"
|
|
--build-arg "OCI_IMAGE_REVISION=${REVISION}"
|
|
--build-arg "OCI_IMAGE_VERSION=${TAG}"
|
|
)
|
|
|
|
platform_args=()
|
|
if [[ -n "${PLATFORM}" ]]; then
|
|
platform_args=(--platform "${PLATFORM}")
|
|
fi
|
|
|
|
echo "Publishing ReadaBook images to ${REGISTRY} with tag ${TAG}"
|
|
|
|
docker buildx build \
|
|
"${platform_args[@]}" \
|
|
"${build_args[@]}" \
|
|
--tag "${REGISTRY}/api:${TAG}" \
|
|
--push \
|
|
--file Dockerfile \
|
|
.
|
|
|
|
docker buildx build \
|
|
"${platform_args[@]}" \
|
|
"${build_args[@]}" \
|
|
--tag "${REGISTRY}/web:${TAG}" \
|
|
--push \
|
|
--file apps/web/Dockerfile \
|
|
.
|
|
|
|
echo "Published:"
|
|
echo " ${REGISTRY}/api:${TAG}"
|
|
echo " ${REGISTRY}/web:${TAG}"
|