Update docker-image.yml

This commit is contained in:
Noxcis 2024-10-10 02:12:02 -05:00 committed by GitHub
parent 47d9d8693a
commit 28206fb37d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,45 +2,56 @@ name: Build and Push Docker Image (Daily)
on: on:
schedule: schedule:
- cron: "0 0 * * *" # Schedule the workflow to run daily at midnight (UTC time). Adjust the time if needed. - cron: "0 0 * * *" # Daily at midnight (UTC)
workflow_dispatch: # Manual run trigger workflow_dispatch: # Allows manual triggering of the workflow
inputs: inputs:
trigger-build: trigger-build:
description: 'Trigger a manual build and push' description: 'Trigger a manual build and push'
default: 'true' default: 'true'
jobs: jobs:
build_and_push: build_and_push_multiarch:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
timeout-minutes: 42 # Job will timeout after 42 minutes
steps: steps:
# Check out the repository code # Step 1: Check out the repository code
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
# Use Node.js version 18 # Step 2: Set up Node.js version 18
- name: Use Node.js version 18 - name: Use Node.js version 18
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18 node-version: 18
# Log in to Docker Hub (replace with the appropriate registry if using something else) # Step 3: Log in to Docker Hub using secrets
- 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.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
# Set up Docker Buildx (needed for multi-platform builds)
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# Build and push Docker image for multiple platforms # Step 4: Create and use a new builder with multi-platform support
- name: Build and Push Docker Image - name: Set up Docker Buildx (Multi-Arch Builder)
uses: docker/setup-buildx-action@v3
with:
driver-opts: image=moby/buildkit:master
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
# Step 5: Set up QEMU (for multi-platform emulation)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
# Step 6: Build and Push Docker Image with multi-platform support (No cache)
- name: Build and Push Docker Image (Multi-Arch)
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . # Path to the directory containing the Dockerfile (subfolder) context: . # Path to Dockerfile in repository
push: true push: true # Push image after build
tags: noxcis/darkwire:terra-firma tags: noxcis/darkwire:terra-firma # Tag for all platforms
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 # Platforms to build for
no-cache: true # Disable caching to force a fresh build