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:
- 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
@ -9,6 +15,17 @@ cache:
paths:
- 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-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:
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 vendor/ database/schema database/seeders database/factories/*
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSION}
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH}
tags:
- docker
- x86_64

View File

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