Github Repo

This commit is contained in:
Atridad Lahiji 2024-09-20 23:10:42 -06:00
parent 40048328ca
commit d03482270f
Signed by: atridad
SSH key fingerprint: SHA256:LGomp8Opq0jz+7kbwNcdfTcuaLRb5Nh0k5AchDDb438

View file

@ -1,4 +1,4 @@
name: Build and Push Docker Image
name: Build and Push Multi-Arch Docker Image
on:
push:
@ -9,26 +9,34 @@ on:
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag atridad:${{ github.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install doctl
uses: digitalocean/action-doctl@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Tag images
run: |
docker tag atridad:${{ github.sha }} ${{ secrets.DIGITALOCEAN_REGISTRY }}:${{ github.sha }}
docker tag atridad:${{ github.sha }} ${{ secrets.DIGITALOCEAN_REGISTRY }}:latest
- name: Push images to DO Container Registry
run: |
docker push ${{ secrets.DIGITALOCEAN_REGISTRY }}:${{ github.sha }}
docker push ${{ secrets.DIGITALOCEAN_REGISTRY }}:latest
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest