quality / commitlint (push) Skipped
CD / update-wiki (push) Failing after 8s
quality / changes (push) Successful in 7s
quality / docker-check (push) Skipped
quality / web (push) Successful in 1m8s
quality / api (push) Successful in 41s
CD / quality (push) Successful in 2m0s
CD / publish (push) Failing after 11m24s
- Removed Dockerfile and Dockerfile.test as part of the transition to a pre-built image. - Updated .dockerignore and .gitignore to reflect new build context and ignored files. - Modified docker-compose.yml to use the new image for the application. - Enhanced documentation in AGENTS.md and README.md to include CI/CD details and release process. - Added new dependencies for commit linting and semantic release in package.json and pnpm-lock.yaml. This commit streamlines the Docker setup and improves the CI/CD workflow with Gitea Actions.
73 lines
2.1 KiB
Bash
73 lines
2.1 KiB
Bash
#!/usr/bin/env sh
|
|
# Copy-by-digest зеркало базовых образов в Gitea Container Registry (без rebuild).
|
|
# Требует: docker login в REGISTRY host, docker buildx.
|
|
# REGISTRY=git.shx.one/<owner> (без суффикса /cfdm-buildcache)
|
|
#
|
|
# Источник library-образов — Docker Hub (docker.io).
|
|
# Если тег уже есть в Gitea — skip (без повторного pull).
|
|
# Копируем только linux/amd64 — bake platforms совпадает.
|
|
# Шаг CD не должен падать: неуспешный copy оставляет bake на Docker Hub FROM.
|
|
set -eu
|
|
REGISTRY="${REGISTRY:?REGISTRY required (git.shx.one/<owner>)}"
|
|
CACHE_REPO="${REGISTRY}/cfdm-buildcache"
|
|
ENV_FILE="${MIRROR_ENV_FILE:-}"
|
|
PLATFORM="${MIRROR_PLATFORM:-linux/amd64}"
|
|
RETRIES="${MIRROR_RETRIES:-4}"
|
|
|
|
tmp="$(mktemp)"
|
|
cleanup() { rm -f "$tmp"; }
|
|
trap cleanup EXIT
|
|
|
|
dest_exists() {
|
|
docker buildx imagetools inspect "$1" >/dev/null 2>&1
|
|
}
|
|
|
|
copy_retry() {
|
|
src="$1"
|
|
dest="$2"
|
|
n=0
|
|
while [ "$n" -lt "$RETRIES" ]; do
|
|
n=$((n + 1))
|
|
if docker buildx imagetools create --platform "$PLATFORM" --tag "$dest" "$src"; then
|
|
return 0
|
|
fi
|
|
delay=$((n * 25))
|
|
echo "mirror retry ${n}/${RETRIES}, sleep ${delay}s: ${dest}"
|
|
sleep "$delay"
|
|
done
|
|
return 1
|
|
}
|
|
|
|
mirror() {
|
|
src="$1"
|
|
tag="$2"
|
|
var="$3"
|
|
dest="${CACHE_REPO}:${tag}"
|
|
if dest_exists "$dest"; then
|
|
echo "skip (already in registry): ${dest}"
|
|
printf '%s=%s\n' "$var" "$dest" >>"$tmp"
|
|
return 0
|
|
fi
|
|
echo "mirror ${src} -> ${dest} (${PLATFORM})"
|
|
if copy_retry "$src" "$dest"; then
|
|
printf '%s=%s\n' "$var" "$dest" >>"$tmp"
|
|
return 0
|
|
fi
|
|
echo "warn: ${dest} not mirrored — bake uses Docker Hub FROM for ${var}"
|
|
return 0
|
|
}
|
|
|
|
mirror "docker.io/library/node:22-alpine" "base-node-22-alpine" BASE_NODE
|
|
|
|
echo "----- mirrored BASE_* -----"
|
|
cat "$tmp"
|
|
if [ -n "$ENV_FILE" ]; then
|
|
env_dir="$(dirname "$ENV_FILE")"
|
|
if [ -d "$env_dir" ]; then
|
|
cp "$tmp" "$ENV_FILE"
|
|
echo "wrote ${ENV_FILE}"
|
|
else
|
|
echo "warn: MIRROR_ENV_FILE dir missing (${env_dir}) — skip write"
|
|
fi
|
|
fi
|