Skip to content

Build DockerHub images #71

Build DockerHub images

Build DockerHub images #71

Workflow file for this run

name: Build DockerHub images
on:
push:
tags: ["v*"]
workflow_dispatch:
schedule:
- cron: '23 17 12 * *'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache-qemu
key: ${{ runner.os }}-buildx-cache-qemu
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Calculate docker image tag
id: set-tag
uses: docker/metadata-action@master
with:
images: packeton/packeton
flavor: |
latest=false
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=pep440,pattern={{major}}.{{minor}}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
# file: "Dockerfile"
push: true
tags: "${{ steps.set-tag.outputs.tags }}"
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache-qemu
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# Issue https://github.com/rust-lang/cargo/issues/10583
build-args: |
CARGO_NET_GIT_FETCH_WITH_CLI=true
# 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-qemu
mv /tmp/.buildx-cache-new /tmp/.buildx-cache-qemu