Skip to content

Docker Build

Docker Build #1018

Workflow file for this run

name: Docker Build
on:
schedule:
# Schedule runs run off HEAD commit on master.
# Run once a day to keep yunojuno/heroku up to
# date with Heroku's base image.
- cron: '0 23 * * *'
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
docker-build-push:
name: Build Docker image & push (if master)
runs-on: ubuntu-latest
steps:
# QEMU gives us ARM architecture support. GitHub Actions
# can only build amd64 versions & 386.
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Docker Meta handles manipulating various GitHub
# Action contexts into sane Docker image tags &
# labels. See more below.
- name: Instantiate Docker Meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: yunojuno/heroku
tags: |
type=sha
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value=3.12-latest
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
# Pull forces Docker to check the network for the
# latest version of base images.
pull: true
# Push image only when on master.
push: ${{ github.ref == 'refs/heads/master' }}
# Use Docker Meta to set the tags & OCI Image Format labels.
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
no-cache: true
# Build for both architectures (devs have M1)
platforms: linux/amd64,linux/arm64