Implement multiarch docker build and enable armv7l

This commit is contained in:
Deon George 2023-10-15 20:51:49 +11:00
parent a7e8cc7568
commit 8ce3ce8164
5 changed files with 52 additions and 15 deletions

View File

@ -1,6 +1,12 @@
stages: stages:
- test - test
- build - build
- build-manifest
variables:
DOCKER_HOST: tcp://docker:2375
VERSION: latest
VERSIONARCH: ${VERSION}-${ARCH}
# This folder is cached between builds # This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache # http://docs.gitlab.com/ce/ci/yaml/README.html#cache
@ -9,6 +15,17 @@ cache:
paths: paths:
- vendor/ - 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: include:
- .gitlab-test.yml - .gitlab-test.yml
- .gitlab-docker-x86_64.yml - .gitlab-docker-x86_64.yml
- .gitlab-docker-armv7l.yml
- .gitlab-docker-manifest.yml

18
.gitlab-docker-armv7l.yml Normal file
View File

@ -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 vendor/ database/schema database/seeders database/factories/*
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH}
tags:
- docker
- armv7l
only:
- master

View File

@ -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

View File

@ -1,25 +1,16 @@
docker: x86_64:build:
variables: variables:
VERSION: latest ARCH: x86_64
DOCKER_HOST: tcp://docker:2375
stage: build 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: script:
- if [ -f init ]; then chmod 500 init; fi - if [ -f init ]; then chmod 500 init; fi
- echo -n ${CI_COMMIT_SHORT_SHA} > VERSION - echo -n ${CI_COMMIT_SHORT_SHA} > VERSION
- rm -rf vendor/ database/schema database/seeders database/factories/* - rm -rf vendor/ database/schema database/seeders database/factories/*
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} . - docker build -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSION} - docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH}
tags: tags:
- docker - docker
- x86_64 - x86_64

View File

@ -1,4 +1,4 @@
test: x86_64:test:
image: ${CI_REGISTRY}/leenooks/php:8.1-fpm-alpine-pgsql-server-test image: ${CI_REGISTRY}/leenooks/php:8.1-fpm-alpine-pgsql-server-test
stage: test stage: test
@ -15,6 +15,7 @@ test:
tags: tags:
- php - php
- x86_64
only: only:
- master - master