ci(bstein-home): avoid external buildkit dependency

This commit is contained in:
codex 2026-04-21 15:55:49 -03:00
parent a0c403a64c
commit 9a9704897f
3 changed files with 29 additions and 32 deletions

View File

@ -1,4 +1,4 @@
FROM python:3.12-slim
FROM registry.bstein.dev/bstein/python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

View File

@ -1,5 +1,5 @@
# Build stage
FROM node:20-alpine AS build
FROM registry.bstein.dev/bstein/node:20-bookworm AS build
WORKDIR /app
COPY frontend/package*.json ./

57
Jenkinsfile vendored
View File

@ -219,7 +219,7 @@ PY
}
}
stage('Buildx setup') {
stage('Docker readiness') {
steps {
container('builder') {
sh '''
@ -239,22 +239,11 @@ PY
echo "docker daemon did not become ready on ${DOCKER_HOST}" >&2
docker version || true
rc=1
else
BUILDER_NAME="bstein-builder-${BUILD_NUMBER}"
docker buildx rm "${BUILDER_NAME}" >/dev/null 2>&1 || true
docker buildx create --name "${BUILDER_NAME}" --driver docker-container \
--driver-opt image=moby/buildkit:buildx-stable-1 \
--bootstrap --use
rc=$?
if [ "${rc}" -eq 0 ]; then
docker buildx inspect "${BUILDER_NAME}" --bootstrap
rc=$?
fi
fi
set -e
printf '%s\n' "${rc}" > build/buildx.rc
printf '%s\n' "${rc}" > build/docker-ready.rc
if [ "${rc}" -ne 0 ]; then
echo "warning: buildx setup failed; publish stages will fail later" >&2
echo "warning: docker daemon readiness failed; publish stages will fail later" >&2
fi
'''
}
@ -481,15 +470,19 @@ PY
container('builder') {
sh '''
set -euo pipefail
test "$(cat build/buildx.rc 2>/dev/null || echo 1)" -eq 0
test "$(cat build/docker-ready.rc 2>/dev/null || echo 1)" -eq 0
VERSION_TAG="$(cut -d= -f2 build.env)"
docker buildx build \
--platform linux/arm64 \
--tag "${FRONT_IMAGE}:${VERSION_TAG}" \
--tag "${FRONT_IMAGE}:latest" \
--file Dockerfile.frontend \
--push \
.
for attempt in 1 2 3; do
if docker build --pull --tag "${FRONT_IMAGE}:${VERSION_TAG}" --tag "${FRONT_IMAGE}:latest" --file Dockerfile.frontend .; then
break
fi
if [ "${attempt}" -eq 3 ]; then
exit 1
fi
sleep $((attempt * 10))
done
docker push "${FRONT_IMAGE}:${VERSION_TAG}"
docker push "${FRONT_IMAGE}:latest"
'''
}
}
@ -500,15 +493,19 @@ PY
container('builder') {
sh '''
set -euo pipefail
test "$(cat build/buildx.rc 2>/dev/null || echo 1)" -eq 0
test "$(cat build/docker-ready.rc 2>/dev/null || echo 1)" -eq 0
VERSION_TAG="$(cut -d= -f2 build.env)"
docker buildx build \
--platform linux/arm64 \
--tag "${BACK_IMAGE}:${VERSION_TAG}" \
--tag "${BACK_IMAGE}:latest" \
--file Dockerfile.backend \
--push \
.
for attempt in 1 2 3; do
if docker build --pull --tag "${BACK_IMAGE}:${VERSION_TAG}" --tag "${BACK_IMAGE}:latest" --file Dockerfile.backend .; then
break
fi
if [ "${attempt}" -eq 3 ]; then
exit 1
fi
sleep $((attempt * 10))
done
docker push "${BACK_IMAGE}:${VERSION_TAG}"
docker push "${BACK_IMAGE}:latest"
'''
}
}