Skip to content

Bump docker/login-action from 2 to 3 #7

Bump docker/login-action from 2 to 3

Bump docker/login-action from 2 to 3 #7

Workflow file for this run

# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
# https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Create and publish a Docker image
on:
schedule:
# * is a special character in YAML so you have to quote this string
# every Sunday at UTC midnight
- cron: '0 0 * * 0'
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ '*.*.*' ]
pull_request:
branches: [ master ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
# notes: break up into 2 sequential steps to build base image then
# code image and build times go way way down? How to version each
# component? Want same repo for `requirements.txt` reference
# and use.
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/build-push-action/issues/498
# https://github.com/docker/buildx/issues/834
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
# buildkitd-flags: --debug
driver-opts: image=moby/buildkit:v0.9.1
-
name: Cache Docker layers
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
# linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
# for details on linux/arm/v6 (raspberry pi 0) support,
# see here: https://raspberrypi.stackexchange.com/questions/111130/how-to-install-nodejs-v12-on-raspi-zero-armv6-not-available-for-download-anymor
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
-
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache