changed workflow for use build-args from versions.env in buildx builder
Some checks failed
Docker Build Smart Logic / Build amd64 & arm64 (push) Failing after 5s
Some checks failed
Docker Build Smart Logic / Build amd64 & arm64 (push) Failing after 5s
This commit is contained in:
@@ -19,6 +19,7 @@ jobs:
|
|||||||
runs-on: buildx-multiarch
|
runs-on: buildx-multiarch
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: http://git.pi-farm.de/pi-farm/checkout@v4
|
uses: http://git.pi-farm.de/pi-farm/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -134,23 +135,57 @@ jobs:
|
|||||||
|
|
||||||
echo "DOCKER_TAGS=$TAGS" >> $GITEA_ENV
|
echo "DOCKER_TAGS=$TAGS" >> $GITEA_ENV
|
||||||
|
|
||||||
|
- name: Load versions.env
|
||||||
|
id: load_env
|
||||||
|
run: |
|
||||||
|
echo "Lade versions.env"
|
||||||
|
set -a
|
||||||
|
source versions.env
|
||||||
|
set +a
|
||||||
|
# Schreibe die wichtigsten Variablen ins GITEA_ENV für weitere Steps
|
||||||
|
echo "BASE_IMAGE=$BASE_IMAGE" >> $GITEA_ENV
|
||||||
|
echo "APP_VERSION=$APP_VERSION" >> $GITEA_ENV
|
||||||
|
echo "TARGET_PLATFORMS=$TARGET_PLATFORMS" >> $GITEA_ENV
|
||||||
|
echo "IMAGE_NAME=${REGISTRY_HOST}/${IMAGE_BASE}" >> $GITEA_ENV
|
||||||
|
echo "CACHE_IMAGE_NAME=${REGISTRY_HOST}/${IMAGE_BASE}-cache" >> $GITEA_ENV
|
||||||
|
echo "VERSION=${{ gitea.ref_name }}" >> $GITEA_ENV
|
||||||
|
echo "BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITEA_ENV
|
||||||
|
|
||||||
- name: Build & push multiarch
|
- name: Build & push multiarch
|
||||||
if: steps.check_files.outputs.should_build == 'true'
|
if: steps.check_files.outputs.should_build == 'true'
|
||||||
run: |
|
run: |
|
||||||
IFS=',' read -ra TAGARRAY <<< "$DOCKER_TAGS"
|
echo "== Multiarch Build Start =="
|
||||||
TAG_ARGS=""
|
|
||||||
for tag in "${TAGARRAY[@]}"; do
|
|
||||||
TAG_ARGS="$TAG_ARGS -t $tag"
|
|
||||||
done
|
|
||||||
|
|
||||||
|
# Build amd64
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform linux/amd64,linux/arm64 \
|
--platform linux/amd64 \
|
||||||
-f ${AMD64_DOCKERFILE} \
|
-f ${AMD64_DOCKERFILE} \
|
||||||
--build-arg BUILD_DATE=${BUILD_DATE} \
|
--build-arg BASE_IMAGE=$BASE_IMAGE \
|
||||||
--build-arg VERSION=${VERSION} \
|
--build-arg APP_VERSION=$APP_VERSION \
|
||||||
$TAG_ARGS \
|
--label org.opencontainers.image.version=$APP_VERSION \
|
||||||
|
--label org.opencontainers.image.created=$BUILD_DATE \
|
||||||
|
-t ${CACHE_IMAGE_NAME}:${VERSION}-amd64 \
|
||||||
--push .
|
--push .
|
||||||
|
|
||||||
|
# Build arm64
|
||||||
|
docker buildx build \
|
||||||
|
--platform linux/arm64 \
|
||||||
|
-f ${ARM64_DOCKERFILE} \
|
||||||
|
--build-arg BASE_IMAGE=$BASE_IMAGE \
|
||||||
|
--build-arg APP_VERSION=$APP_VERSION \
|
||||||
|
--label org.opencontainers.image.version=$APP_VERSION \
|
||||||
|
--label org.opencontainers.image.created=$BUILD_DATE \
|
||||||
|
-t ${CACHE_IMAGE_NAME}:${VERSION}-arm64 \
|
||||||
|
--push .
|
||||||
|
|
||||||
|
# Merge into manifest
|
||||||
|
docker buildx imagetools create -t ${IMAGE_NAME}:${VERSION} \
|
||||||
|
${CACHE_IMAGE_NAME}:${VERSION}-amd64 \
|
||||||
|
${CACHE_IMAGE_NAME}:${VERSION}-arm64
|
||||||
|
|
||||||
|
echo "== Multiarch Build Complete =="
|
||||||
|
|
||||||
|
|
||||||
- name: Generate SBOM
|
- name: Generate SBOM
|
||||||
run: |
|
run: |
|
||||||
docker sbom ${IMAGE_NAME}:edge > sbom.spdx.json || true
|
docker sbom ${IMAGE_NAME}:edge > sbom.spdx.json || true
|
||||||
|
|||||||
Reference in New Issue
Block a user