feat: create reusable action for setting up Docker environment in workflows
Some checks failed
Build Docker Image for Pull Request / build (pull_request) Failing after 6s

This commit is contained in:
2025-02-09 15:57:50 +01:00
parent 80adb79196
commit e7b5023134
3 changed files with 22 additions and 19 deletions

View File

@@ -0,0 +1,14 @@
name: "Setup Docker Environment"
description: "Common steps for setting up Docker build environment (checkout, QEMU, and Buildx)"
runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.4.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.9.0

View File

@@ -1,4 +1,4 @@
name: Build Docker Image for Feature PRs name: Build Docker Image for Pull Request
on: on:
pull_request: pull_request:
@@ -10,19 +10,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Setup Docker Environment
uses: actions/checkout@v4.2.2 uses: ./.github/actions/setup-docker-environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.4.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.9.0
- name: Build Docker image - name: Build Docker image
uses: docker/build-push-action@v6.13.0 uses: docker/build-push-action@v6.13.0
with: with:
context: . context: .
push: false
tags: ${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.event.pull_request.number }} tags: ${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.event.pull_request.number }}
platforms: | platforms: |
linux/amd64 linux/amd64

View File

@@ -12,22 +12,16 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Setup Docker Environment
uses: actions/checkout@v4.2.2 uses: ./.github/actions/setup-docker-environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.4.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.9.0
- name: Log in to Docker registry - name: Log in to Docker registry
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.3.0
with: with:
registry: ${{ env.REGISTRY_URL }} registry: ${{ env.REGISTRY_URL }}
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v6.13.0 uses: docker/build-push-action@v6.13.0
with: with: