updated the build file

Please enter the commit message for your changes. Lines starting
This commit is contained in:
Christian Krakau-Louis
2025-03-27 15:56:32 +01:00
parent 373efa0e03
commit be71f99f06
+38 -4
View File
@@ -1,8 +1,17 @@
name: Build and Push Docker Image name: Build and Push Docker Image
permissions:
contents: read
packages: write
on: on:
push: push:
branches: [ "main" ] branches:
- main
- develop
pull_request:
branches:
- main
jobs: jobs:
build-and-push: build-and-push:
@@ -12,15 +21,40 @@ jobs:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push - name: Log in to GitHub Container Registry
uses: docker/build-push-action@v3 uses: docker/login-action@v2
with: with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v4
with:
# Build for multiple platforms
platforms: linux/amd64,linux/arm64
# Path to Docker context and Dockerfile (adjust if needed)
context: . context: .
file: Dockerfile
# Push images to both Docker Hub and GHCR
push: true push: true
tags: your-dockerhub-username/random-pdf:latest tags: |
christianlouis/docdice:latest
christianlouis/docdice:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/docdice:latest
ghcr.io/${{ github.repository_owner }}/docdice:${{ github.sha }}
# Caching options to speed up subsequent builds
cache-from: type=gha
cache-to: type=gha,mode=max