Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-platform builds using GitHub workflows #70

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 7 additions & 2 deletions .github/workflows/hooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ jobs:
matrix:
version: ['10.0', '11.0', '12.0', '13.0']
php: ['7.3']
archi: ['amd64']
variant: ['apache', 'fpm', 'fpm-alpine']

steps:
- name: Check Out Repo
uses: actions/checkout@v2

- name: Setup QEMU
uses: docker/setup-qemu-action@v1

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Execute CI hooks
id: docker_hooks
run: |
cd images/${{ matrix.version }}/php${{ matrix.php }}-${{ matrix.variant }}-${{ matrix.archi }}
cd images/${{ matrix.version }}/php${{ matrix.php }}-${{ matrix.variant }}
./hooks/run

- name: Display docker images
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

name: Docker Image Push

on:
workflow_dispatch:
inputs:
version:
description: 'Image version to push (only specify one)'
required: true
default: '14.0'
platform:
description: 'Comma-separated list of platforms'
required: true
default: 'linux/arm/v7,linux/arm64,linux/386,linux/amd64'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.3']
variant: ['apache', 'fpm', 'fpm-alpine']

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup QEMU
uses: docker/setup-qemu-action@v1

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Execute push hook
id: docker_push_hook
env:
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_PLATFORM: ${{ github.event.inputs.platform }}
run: |
cd images/${{ github.event.inputs.version }}/php${{ matrix.php }}-${{ matrix.variant }}
./hooks/run_push
67 changes: 23 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ branches:
before_install:
- env | sort
- export home=$(pwd)
- export travis_dir="${home}/images/${VERSION}/php${PHP_VERSION}-${VARIANT}-${ARCHI}"
- export TAG=${VERSION}-php${PHP_VERSION}-${VARIANT}-${ARCHI}
- export travis_dir="${home}/images/${VERSION}/php${PHP_VERSION}-${VARIANT}"
- export TAG=${VERSION}-php${PHP_VERSION}-${VARIANT}
- export VCS_REF=`git rev-parse --short HEAD`
- export BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
- export IMAGE_NAME=monogramm/docker-dolibarr:${TAG}
Expand Down Expand Up @@ -63,47 +63,26 @@ matrix:
# # Ref: https://docs.travis-ci.com/user/reference/osx
# osx_image: xcode11.3
allow_failures:
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=fpm-alpine ARCHI=i386
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=fpm-alpine ARCHI=amd64
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=fpm ARCHI=i386
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=fpm ARCHI=amd64
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=apache ARCHI=i386
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=apache ARCHI=amd64
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=fpm-alpine
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=fpm
- env: VERSION=develop PHP_VERSION=7.2 VARIANT=apache

env: # Environments
- VERSION=develop PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=i386
- VERSION=develop PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=amd64
- VERSION=develop PHP_VERSION=7.3 VARIANT=fpm ARCHI=i386
- VERSION=develop PHP_VERSION=7.3 VARIANT=fpm ARCHI=amd64
- VERSION=develop PHP_VERSION=7.3 VARIANT=apache ARCHI=i386
- VERSION=develop PHP_VERSION=7.3 VARIANT=apache ARCHI=amd64
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=i386
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=amd64
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=i386
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=amd64
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=i386
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=amd64
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=i386
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=amd64
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=i386
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=amd64
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=i386
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=amd64
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=i386
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=amd64
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=i386
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=amd64
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=i386
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=amd64
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=i386
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=amd64
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=i386
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=amd64
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=i386
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=amd64
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=i386
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=fpm-alpine ARCHI=amd64
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=i386
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=fpm ARCHI=amd64
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=i386
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=apache ARCHI=amd64
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=apache
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=fpm
- VERSION=14.0 PHP_VERSION=7.3 VARIANT=fpm-alpine
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=apache
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=fpm
- VERSION=13.0 PHP_VERSION=7.3 VARIANT=fpm-alpine
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=apache
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=fpm
- VERSION=12.0 PHP_VERSION=7.3 VARIANT=fpm-alpine
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=apache
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=fpm
- VERSION=11.0 PHP_VERSION=7.3 VARIANT=fpm-alpine
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=apache
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=fpm
- VERSION=10.0 PHP_VERSION=7.3 VARIANT=fpm-alpine
- VERSION=develop PHP_VERSION=7.3 VARIANT=apache
- VERSION=develop PHP_VERSION=7.3 VARIANT=fpm
- VERSION=develop PHP_VERSION=7.3 VARIANT=fpm-alpine
150 changes: 0 additions & 150 deletions images/10.0/php7.3-apache-amd64/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion images/10.0/php7.3-apache-i386/.dockertags

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM i386/php:7.3-apache
FROM php:7.3-apache

# Install the packages we need
# Install the PHP extensions we need
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ services:
context: ./
dockerfile: Dockerfile
args:
- TAG=${TAG}
- VCS_REF=${VCS_REF}
- BUILD_DATE=${BUILD_DATE}
image: ${IMAGE_NAME}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# https://docs.docker.com/docker-hub/builds/advanced/
# https://microbadger.com/labels

docker build \
--build-arg "TAG=${DOCKER_TAG}" \
docker buildx build \
--build-arg "VCS_REF=$(git rev-parse --short HEAD)" \
--build-arg "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--load \
-f "$DOCKERFILE_PATH" \
-t "$IMAGE_NAME" .
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
if [ -f ./.dockertags ]; then
for tag in $(cat ./.dockertags); do
if [ ! "${tag}" = "${DOCKER_TAG}" ]; then
docker tag "$IMAGE_NAME" "$DOCKER_REPO:$tag"
docker push "$DOCKER_REPO:$tag"
docker buildx build \
--build-arg "VCS_REF=$(git rev-parse --short HEAD)" \
--build-arg "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--platform "$DOCKER_PLATFORM" \
--push \
-f "$DOCKERFILE_PATH" \
-t "$DOCKER_REPO:$tag" .
fi
done
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# https://docs.docker.com/docker-hub/builds/advanced/

if [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY}" ]; then
docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY}"
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_LOGIN}" --password-stdin "${DOCKER_REGISTRY}"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ if [ ! -f '.env' ]; then
mv .env.tmp .env
fi

export VCS_REF=$(git rev-parse --short HEAD)
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

#echo 'Preparing persisted data...'
#mkdir -p "${APP_HOME:-/srv/dolibarr}"
#chown 777 "${APP_HOME:-/srv/dolibarr}"
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ COMMIT_MSG=$(git log -1 --format=%s)

export DOCKER_REPO=monogramm/docker-dolibarr
export DOCKERFILE_PATH=Dockerfile
export DOCKER_TAG=10.0
export DOCKER_TAG=${VARIANT}
export IMAGE_NAME=${DOCKER_REPO}:${DOCKER_TAG}

# Execute hooks in given order
IFS=',' read -ra STEPS <<< "${1:-build,test}"
IFS=',' read -ra STEPS <<< "${1:-push}"
for step in "${STEPS[@]}"
do
for hook in "pre_${step}" "${step}" "post_${step}"; do
Expand Down
File renamed without changes.
Loading