Skip to content

Commit

Permalink
Merge pull request #185 from bryanlatten/eol-versions-arm-8.1
Browse files Browse the repository at this point in the history
Major: removed EOL PHP versions, added multi-arch, added github actions support
  • Loading branch information
adobejmong authored Dec 17, 2021
2 parents 86aa289 + f7260af commit ae9d5f1
Show file tree
Hide file tree
Showing 35 changed files with 458 additions and 1,034 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: ci

on:
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
variant:
- 7.4
- 7.4-alpine
- 8.0
platform:
- linux/amd64
# - linux/arm64
exclude:
- props:
Dockerfile: Dockerfile-7.4-alpine
- platform: linux/arm64
env:
TEST_MATCH: PHP Version ${{ matrix.props.version }}
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Detect host configuration
run: |
# NOTE: Docker host configuration determines the networking target for integration testing
v=$(mount | grep "/run/docker.sock")
TARGET_HOST=
if [ -n "$v" ]; then
echo "Injected docker socket detected"
TARGET_HOST="host.docker.internal"
elif [ -S /var/run/docker.sock ]; then
TARGET_HOST="localhost"
else
echo "No Docker socket detected, fail"
exit 1
fi
echo "TARGET_HOST=${TARGET_HOST}" >> $GITHUB_ENV
-
# Build and execute in multiple configurations: vanilla, with env overrides, with TLS enabled
name: Build and test
run: |
# NOTE: docker qemu and buildx setup actions create a black hole for build cache layers, avoid unless pushing externally
# Setup multi-arch platforms, noop if already installed for builder
docker run --privileged --rm tonistiigi/binfmt --install arm64,amd64
TARGET_PLATFORM=${{ matrix.platform }}
PHP_VARIANT=${{ matrix.variant }}
PLATFORM=${TARGET_PLATFORM} PHP_VARIANT=${PHP_VARIANT} ./test.sh $TARGET_HOST
72 changes: 72 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: publish

on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
env:
IMAGE_BASE: behance/docker-php
strategy:
matrix:
# Variant distributions all have semantic versions + PHP version + suffix (ex. 3.2.1-alpine)
props:
- Dockerfile: Dockerfile-7.4-alpine
version: "7.4"
suffix: alpine
platforms: linux/amd64
- Dockerfile: Dockerfile-7.4
version: "7.4"
platforms: linux/amd64,linux/arm64
- Dockerfile: Dockerfile-8.0
version: "8.0"
platforms: linux/amd64,linux/arm64
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Add tag suffix if one exists
if: matrix.props.suffix
run: |
echo TAG_SUFFIX="-${{ matrix.props.suffix }}" >> $GITHUB_ENV
-
name: Docker meta
id: meta
if: github.event_name != 'pull_request'
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGE_BASE }}
tags: |
type=raw,priority=100,value=${{ matrix.props.version }}
type=semver,priority=200,prefix=${{ matrix.props.version }}-,pattern={{major}}
type=semver,priority=300,prefix=${{ matrix.props.version }}-,pattern={{major}}.{{minor}}
type=semver,priority=400,prefix=${{ matrix.props.version }}-,pattern={{major}}.{{minor}}.{{patch}}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build + push
uses: docker/build-push-action@v2
with:
context: .
platforms: ${{ matrix.props.platforms }}
file: ${{ matrix.props.Dockerfile }}
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
sudo: required

env:
- PHP_VARIANT=7.0
- PHP_VARIANT=7.1
- PHP_VARIANT=7.2
- PHP_VARIANT=7.3
- PHP_VARIANT=7.3-alpine
- PHP_VARIANT=7.4
- PHP_VARIANT=8.0
global:
- GOSS_INSTALL_PATH="./"
jobs:
- PHP_VARIANT=7.4-alpine
- PHP_VARIANT=7.4
- PHP_VARIANT=8.0

services:
- docker
Expand Down
160 changes: 0 additions & 160 deletions Dockerfile-7.0

This file was deleted.

Loading

0 comments on commit ae9d5f1

Please sign in to comment.