Build and Push Captaind Nightly #8
This file contains hidden or 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
name: Build and Push Captaind Nightly | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 2 * * *" | |
jobs: | |
build-and-push: | |
strategy: | |
matrix: | |
include: | |
- runner: ubuntu-latest | |
platform: linux/amd64 | |
arch: amd64 | |
- runner: ubuntu-24.04-arm | |
platform: linux/arm64 | |
arch: arm64 | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Generate date tag | |
id: date | |
run: echo "tag=nightly-$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Build and push ${{ matrix.arch }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./nightly | |
file: ./nightly/captaind.Dockerfile | |
platforms: ${{ matrix.platform }} | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/captaind:${{ steps.date.outputs.tag }}-${{ matrix.arch }} | |
${{ secrets.DOCKERHUB_USERNAME }}/captaind:nightly-${{ matrix.arch }} | |
cache-from: type=gha,scope=${{ matrix.arch }} | |
cache-to: type=gha,mode=max,scope=${{ matrix.arch }} | |
create-manifest: | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Generate date tag | |
id: date | |
run: echo "tag=nightly-$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Create and push multi-arch manifest | |
run: | | |
docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/captaind:${{ steps.date.outputs.tag }} \ | |
${{ secrets.DOCKERHUB_USERNAME }}/captaind:${{ steps.date.outputs.tag }}-amd64 \ | |
${{ secrets.DOCKERHUB_USERNAME }}/captaind:${{ steps.date.outputs.tag }}-arm64 | |
docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/captaind:nightly \ | |
${{ secrets.DOCKERHUB_USERNAME }}/captaind:nightly-amd64 \ | |
${{ secrets.DOCKERHUB_USERNAME }}/captaind:nightly-arm64 |