Skip to content

Commit

Permalink
Update wg-dash_daily-builds.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
NOXCIS authored Oct 8, 2024
1 parent d9ba0c6 commit 5e32d41
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions .github/workflows/wg-dash_daily-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Build and Push Docker Image (Daily)

on:
schedule:
- cron: "0 0 * * *" # Schedule the workflow to run daily at midnight (UTC time)
workflow_dispatch: # Manual run trigger
- cron: "0 0 * * *" # Daily at midnight (UTC)
workflow_dispatch: # Allows manual triggering of the workflow
inputs:
trigger-build:
description: 'Trigger a manual build and push'
Expand All @@ -12,48 +12,38 @@ on:
jobs:
build_and_push_multiarch:
runs-on: ubuntu-22.04
timeout-minutes: 42 # Set a timeout of 4 hours
timeout-minutes: 42 # Job will timeout after 42 minutes

steps:
# Check out the repository code
# Step 1: Check out the repository code
- name: Checkout code
uses: actions/checkout@v3

# Use Node.js version 18
# Step 2: Set up Node.js version 18
- name: Use Node.js version 18
uses: actions/setup-node@v4
with:
node-version: 18

# Log in to Docker Hub
# Step 3: Log in to Docker Hub using secrets
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Set up Docker Buildx (multi-platform support)
# Step 4: Set up Docker Buildx (for multi-platform support)
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

# Cache Docker layers to speed up builds
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Build and push Docker image with multi-platform support
# Step 5: 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
with:
context: WG-Dash/ # Path to the directory containing the Dockerfile
push: true # Push the image to the registry
tags: noxcis/wg-dashboard:terra-firma # Single tag for all platforms
platforms: linux/amd64,linux/arm64,linux/arm/v7 # List of platforms
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: --progress=plain
context: WG-Dash/ # Path to Dockerfile in repository
push: true # Push image after build
tags: noxcis/wg-dashboard:terra-firma # Tag for all platforms
platforms: linux/amd64,linux/arm64,linux/arm/v7 # Platforms to build for
no-cache: true # Disable caching to force a fresh build
build-args: --progress=plain # Show plain progress in logs

0 comments on commit 5e32d41

Please sign in to comment.