Switch to Actuated for docker builds (#1312)
This commit is contained in:
parent
427d4bd873
commit
5a353d5ed1
1 changed files with 108 additions and 45 deletions
153
.github/workflows/docker.yaml
vendored
153
.github/workflows/docker.yaml
vendored
|
@ -1,63 +1,126 @@
|
||||||
name: Build docker image
|
name: build-docker
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ master ]
|
||||||
- 'main'
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
name: build and publish atuin image
|
publish_x86:
|
||||||
runs-on: ubuntu-latest
|
concurrency:
|
||||||
|
group: ${{ github.ref }}-x86
|
||||||
|
cancel-in-progress: true
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
runs-on: actuated
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
- name: Check Out Repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/${{ github.repository }}
|
repository: atuinsh/atuin
|
||||||
tags: |
|
path: "./"
|
||||||
type=ref,event=pr
|
|
||||||
type=ref,event=branch
|
- name: Setup mirror
|
||||||
type=semver,pattern={{version}}
|
uses: self-actuated/hub-mirror@master
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
|
- name: Get Repo Owner
|
||||||
|
id: get_repo_owner
|
||||||
|
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
- name: Login to container Registry
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
username: ${{ github.repository_owner }}
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
registry: ghcr.io
|
||||||
|
|
||||||
- name: Build and push
|
- name: Release build
|
||||||
id: docker_build
|
id: release_build
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: ./
|
outputs: "type=registry,push=true"
|
||||||
|
platforms: linux/amd64
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
context: .
|
||||||
push: true
|
provenance: false
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
build-args: |
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
Version=dev
|
||||||
platforms: linux/amd64 #,linux/arm64
|
GitCommit=${{ github.sha }}
|
||||||
cache-from: type=gha
|
tags: |
|
||||||
cache-to: type=gha,mode=max
|
ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }}-amd64
|
||||||
build-args: RUST_BACKTRACE=1
|
|
||||||
|
|
||||||
|
publish_aarch64:
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}-aarch64
|
||||||
|
cancel-in-progress: true
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
runs-on: actuated-aarch64
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
with:
|
||||||
|
repository: atuinsh/atuin
|
||||||
|
path: "./"
|
||||||
|
|
||||||
|
- name: Setup mirror
|
||||||
|
uses: self-actuated/hub-mirror@master
|
||||||
|
|
||||||
|
- name: Get Repo Owner
|
||||||
|
id: get_repo_owner
|
||||||
|
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
- name: Login to container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
registry: ghcr.io
|
||||||
|
|
||||||
|
- name: Release build
|
||||||
|
id: release_build
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
outputs: "type=registry,push=true"
|
||||||
|
platforms: linux/arm64
|
||||||
|
file: ./Dockerfile
|
||||||
|
context: .
|
||||||
|
provenance: false
|
||||||
|
build-args: |
|
||||||
|
Version=dev
|
||||||
|
GitCommit=${{ github.sha }}
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }}-aarch64
|
||||||
|
|
||||||
|
publish_manifest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [publish_x86, publish_aarch64]
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Get Repo Owner
|
||||||
|
id: get_repo_owner
|
||||||
|
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Login to container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
registry: ghcr.io
|
||||||
|
|
||||||
|
- name: Create manifest
|
||||||
|
run: |
|
||||||
|
docker manifest create ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }} \
|
||||||
|
--amend ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }}-amd64 \
|
||||||
|
--amend ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }}-aarch64
|
||||||
|
docker manifest annotate --arch amd64 --os linux ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }} ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }}-amd64
|
||||||
|
docker manifest annotate --arch arm64 --os linux ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }} ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }}-aarch64
|
||||||
|
docker manifest inspect ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }}
|
||||||
|
|
||||||
|
docker manifest push ghcr.io/${{ env.REPO_OWNER }}/atuin:${{ github.sha }}
|
||||||
|
|
||||||
- name: Image digest
|
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
||||||
|
|
Loading…
Reference in a new issue