Merge pull request #303 from rail/gar #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow is based off of the example at | |
# https://github.com/docker/metadata-action | |
# | |
# Multi-platform configuration from | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md | |
# | |
# Caching from | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md | |
name: Docker | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'build/Dockerfile' | |
# Only build, but don't push, on a PR if it touches the Dockerfile, | |
# since this takes a while to execute. | |
pull_request: | |
paths: | |
- 'build/Dockerfile' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: cockroachdb/activerecord_test_container | |
labels: | | |
org.opencontainers.image.title=Active Record CockroachDB Adapter Test Image | |
org.opencontainers.image.vendor=Cockroach Labs Inc. | |
org.opencontainers.image.description=Environment for running tests | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: build/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |