Skip to content

Commit

Permalink
Github Actions: added PR builder and release hub push (#67)
Browse files Browse the repository at this point in the history
* Github Actions: added PR builder and release hub push

* README: updated release management docs

* Main: enable variant-less build and latest

Co-authored-by: Bryan Latten <latten@adobe.com>
  • Loading branch information
bryanlatten and Bryan Latten authored Dec 9, 2021
1 parent a00ed1a commit 5fe94b8
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: main

on:
push:
tags:
- '*'
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE_BASE: behance/docker-base
strategy:
matrix:
props:
# This is the default variant-less distribution (ex. 3.2.1)
- Dockerfile: Dockerfile-ubuntu-20.04
# Variant distributions below all have semantic versions + suffix (ex. 3.2.1-ubuntu-18.04)
- Dockerfile: Dockerfile-ubuntu-18.04
suffix: ubuntu-18.04
- Dockerfile: Dockerfile-ubuntu-20.04
suffix: ubuntu-20.04
- Dockerfile: Dockerfile-alpine
suffix: alpine
- Dockerfile: Dockerfile-centos-7
suffix: centos-7
- Dockerfile: Dockerfile-centos-8
suffix: centos-8
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Add tag suffix
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=semver,pattern={{major}}.{{minor}}.{{patch}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
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: linux/amd64,linux/arm64
file: ${{ matrix.props.Dockerfile }}
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,15 @@ Directory | Use
`/etc/services-available/` | same as above, but must be symlinked into `/etc/services.d/` to take effect
`/run.d/` | shell scripts (ending in .sh) that make runtime modifications ahead of S6 initialization
`/scripts` | convenience scripts that can be leveraged in derived images

### Release Management

Github actions provide the machinery for producing tags distributed through Docker Hub. Once a tested and approved PR is merged, simply cutting a new semantically-versioned tag will generate the following matrix of tagged builds:
- `[major].[minor].[patch](?-variant)`
- `[major].[minor](?-variant)`
- `[major](?-variant)`
Platform support is available for architectures:
- `linux/arm64`
- `linux/amd64`

To add new variant based on a new Dockerfile, add an entry to the `matrix.props` with its file and variant suffix.

0 comments on commit 5fe94b8

Please sign in to comment.