more tests
This commit is contained in:
parent
dfc72ea7db
commit
9e03158f81
1 changed files with 24 additions and 18 deletions
|
|
@ -4,11 +4,11 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'containers/${{ github.workflow }}/**'
|
- 'containers/${{ github.workflow }}/**' # This path will look for 'containers/Build and Push Ansible Container/**'
|
||||||
- '.forgejo/workflows/ansible.yml'
|
- '.forgejo/workflows/ansible.yml'
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 20 * * 5'
|
- cron: '0 20 * * 5' # Runs every Friday at 8 PM UTC
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
|
|
@ -17,17 +17,21 @@ jobs:
|
||||||
arch: [ amd64, arm64 ]
|
arch: [ amd64, arm64 ]
|
||||||
runs-on: ${{ matrix.arch }}
|
runs-on: ${{ matrix.arch }}
|
||||||
container:
|
container:
|
||||||
image: ubuntu-latest
|
# Use a more suitable base image for package management and common tools.
|
||||||
|
# Debian is often a good balance between size and available packages.
|
||||||
|
# You're using `apk` (Alpine Linux package manager) in an Ubuntu container, which will fail.
|
||||||
|
image: debian:stable-slim # or debian:bookworm-slim, or even a specific Node.js image if you mainly need Node.js
|
||||||
steps:
|
steps:
|
||||||
- name: Install Node.js and dependencies
|
- name: Install build dependencies (apt)
|
||||||
run: |
|
run: |
|
||||||
apk update
|
# Use apt for Debian/Ubuntu based images
|
||||||
apk add --no-cache nodejs npm git bash
|
apt-get update
|
||||||
|
apt-get install -y nodejs npm git bash ca-certificates curl
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Builder
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Forgejo Registry
|
- name: Login to Forgejo Registry
|
||||||
|
|
@ -37,29 +41,30 @@ jobs:
|
||||||
username: ${{ secrets.CI_REGISTRY_USER }}
|
username: ${{ secrets.CI_REGISTRY_USER }}
|
||||||
password: ${{ secrets.CI_TOKEN }}
|
password: ${{ secrets.CI_TOKEN }}
|
||||||
|
|
||||||
- name: Set working directory
|
# Removed the `cd` step as `context` and `file` can handle the path directly.
|
||||||
run: |
|
|
||||||
cd containers/${{ github.workflow }}/
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Build and push (${{ matrix.arch }})
|
- name: Build and push (${{ matrix.arch }})
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: containers/${{ github.workflow }}/
|
context: ./containers/${{ github.workflow }}/ # Relative to the checkout root
|
||||||
file: containers/${{ github.workflow }}/Dockerfile
|
file: ./containers/${{ github.workflow }}/Dockerfile # Relative to the checkout root
|
||||||
platforms: linux/${{ matrix.arch }}
|
platforms: linux/${{ matrix.arch }}
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:${{ matrix.arch }}-latest
|
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:${{ matrix.arch }}-latest
|
||||||
|
cache-from: type=registry,ref=${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:buildcache-${{ matrix.arch }} # Add caching
|
||||||
|
cache-to: type=registry,ref=${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:buildcache-${{ matrix.arch }},mode=max # Add caching
|
||||||
|
|
||||||
manifest:
|
manifest:
|
||||||
needs: build-and-push
|
needs: build-and-push
|
||||||
runs-on: amd64
|
runs-on: ubuntu-latest # or amd64 if you have a specific AMD64 runner for manifest creation
|
||||||
steps:
|
steps:
|
||||||
- name: Install Node.js and dependencies
|
- name: Install Docker CLI
|
||||||
run: |
|
run: |
|
||||||
apk update
|
# Ensure docker CLI is available in the runner environment for `docker manifest`
|
||||||
apk add --no-cache nodejs npm git bash
|
# Most `ubuntu-latest` runners already have it, but explicit is better.
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y docker-ce-cli # Install only the client if the runner is not dind
|
||||||
|
|
||||||
- name: Login to Forgejo Registry
|
- name: Login to Forgejo Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
|
@ -70,6 +75,7 @@ jobs:
|
||||||
|
|
||||||
- name: Create and push multi-arch manifest
|
- name: Create and push multi-arch manifest
|
||||||
run: |
|
run: |
|
||||||
|
# Use the explicit "docker" command which should be available
|
||||||
docker manifest create ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest \
|
docker manifest create ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest \
|
||||||
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:amd64-latest \
|
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:amd64-latest \
|
||||||
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:arm64-latest
|
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:arm64-latest
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue