From 9a938ac3eaad7c61087029448b127cdf24eb5aa1 Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 22 Jan 2024 22:57:56 +1100 Subject: [PATCH] Enable builds for armv7l and arm64 --- .gitlab-ci.yml | 18 ++++++++++++++++++ .gitlab-docker-arm64.yml | 18 ++++++++++++++++++ .gitlab-docker-armv7l.yml | 18 ++++++++++++++++++ .gitlab-docker-manifest.yml | 10 ++++++++++ .gitlab-docker-x86_64.yml | 21 ++++++--------------- .gitlab-test.yml | 4 ++-- 6 files changed, 72 insertions(+), 17 deletions(-) create mode 100644 .gitlab-docker-arm64.yml create mode 100644 .gitlab-docker-armv7l.yml create mode 100644 .gitlab-docker-manifest.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3736a67..3187a1f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,12 @@ stages: - test - build +- build-manifest + +variables: + DOCKER_HOST: tcp://docker:2375 + VERSION: latest + VERSIONARCH: ${VERSION}-${ARCH} # This folder is cached between builds # http://docs.gitlab.com/ce/ci/yaml/README.html#cache @@ -15,6 +21,18 @@ cache: - node_modules/ - vendor/ +image: docker:latest +services: +- docker:dind + +before_script: +- docker info && docker version +- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin +- if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > auth.json; fi + include: - .gitlab-test.yml - .gitlab-docker-x86_64.yml +- .gitlab-docker-armv7l.yml +- .gitlab-docker-arm64.yml +- .gitlab-docker-manifest.yml diff --git a/.gitlab-docker-arm64.yml b/.gitlab-docker-arm64.yml new file mode 100644 index 0000000..6a1306e --- /dev/null +++ b/.gitlab-docker-arm64.yml @@ -0,0 +1,18 @@ +arm64:build: + variables: + ARCH: arm64 + + stage: build + + script: + - if [ -f init ]; then chmod 500 init; fi + - echo -n ${CI_COMMIT_SHORT_SHA} > VERSION + - rm -rf node_modules database/seeds database/schema database/factories/* + - docker build -f docker/Dockerfile -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} . + - docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH} + + tags: + - docker + - arm64 + only: + - master diff --git a/.gitlab-docker-armv7l.yml b/.gitlab-docker-armv7l.yml new file mode 100644 index 0000000..4a232fa --- /dev/null +++ b/.gitlab-docker-armv7l.yml @@ -0,0 +1,18 @@ +armv7l:build: + variables: + ARCH: armv7l + + stage: build + + script: + - if [ -f init ]; then chmod 500 init; fi + - echo -n ${CI_COMMIT_SHORT_SHA} > VERSION + - rm -rf node_modules database/seeds database/schema database/factories/* + - docker build -f docker/Dockerfile -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} . + - docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH} + + tags: + - docker + - armv7l + only: + - master diff --git a/.gitlab-docker-manifest.yml b/.gitlab-docker-manifest.yml new file mode 100644 index 0000000..27285b4 --- /dev/null +++ b/.gitlab-docker-manifest.yml @@ -0,0 +1,10 @@ +x86_64:build-manifest: + stage: build-manifest + script: + - docker manifest create ${CI_REGISTRY_IMAGE}:${VERSION} ${CI_REGISTRY_IMAGE}:${VERSION}-x86_64 ${CI_REGISTRY_IMAGE}:${VERSION}-armv7l ${CI_REGISTRY_IMAGE}:${VERSION}-arm64 + - docker manifest push --purge ${CI_REGISTRY_IMAGE}:${VERSION} + tags: + - docker + - x86_64 + only: + - master diff --git a/.gitlab-docker-x86_64.yml b/.gitlab-docker-x86_64.yml index 84756a4..53c2722 100644 --- a/.gitlab-docker-x86_64.yml +++ b/.gitlab-docker-x86_64.yml @@ -1,27 +1,18 @@ -docker: +x86_64:build: variables: - VERSION: latest - DOCKER_HOST: tcp://docker:2375 + ARCH: x86_64 stage: build - image: docker:latest - services: - - docker:dind - - before_script: - - docker info && docker version - - echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin - - if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > auth.json; fi - script: - if [ -f init ]; then chmod 500 init; fi - echo -n ${CI_COMMIT_SHORT_SHA} > VERSION - rm -rf node_modules database/seeds database/schema database/factories/* - - docker build -f docker/Dockerfile -t ${CI_REGISTRY_IMAGE}:${VERSION} . - - docker push ${CI_REGISTRY_IMAGE}:${VERSION} + - docker build -f docker/Dockerfile -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} . + - docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH} + tags: - docker - x86_64 only: - - BRANCH-2.0 + - master diff --git a/.gitlab-test.yml b/.gitlab-test.yml index 5226ab6..e17e8d6 100644 --- a/.gitlab-test.yml +++ b/.gitlab-test.yml @@ -1,5 +1,5 @@ test: - image: ${CI_REGISTRY}/leenooks/php:8.1-fpm-alpine-ldap-test + image: ${CI_REGISTRY}/leenooks/php:8.3-fpm-ldap-test stage: test @@ -21,7 +21,7 @@ test: tags: - php only: - - BRANCH-2.0 + - master before_script: - mv .env.testing .env