Skip to content

Commit

Permalink
Use different ways to build
Browse files Browse the repository at this point in the history
Should also print for arm (RPi)
  • Loading branch information
felixschndr committed Oct 30, 2024
1 parent 6a856ed commit f1db482
Showing 1 changed file with 42 additions and 15 deletions.
57 changes: 42 additions & 15 deletions .github/workflows/publish_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,54 @@ name: Deploy Images to GitHub Container Registry

on: push

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push-store-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@main

- name: "Login to GitHub Container Registry"
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.CONTAINER_REGISTRY_TOKEN}}

- name: "Build Image and Push to Container Registry"
run: |
docker build . --tag ghcr.io/${{github.repository}}:${{github.ref_name}}
docker push ghcr.io/${{github.repository}}:${{github.ref_name}}
- name: "Build Image as latest and Push to Container Registry"
if: github.ref == 'refs/heads/main'
run: |
docker build . --tag ghcr.io/${{github.repository}}:latest
docker push ghcr.io/${{github.repository}}:latest
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}:latest

0 comments on commit f1db482

Please sign in to comment.