Skip to content

Commit f069bff

Browse files
committed
Update docker images
1 parent 0b36401 commit f069bff

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

.github/workflows/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/loongarchlinux/archlinux:latest
2+
ARG TARGETARCH
3+
RUN pacman --noconfirm -Syu
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Docker Image Builder
2+
3+
on:
4+
push:
5+
# workflow_dispatch:
6+
# schedule:
7+
# # Run once a week on Fridays
8+
# - cron: "0 0 * * FRI"
9+
# pull_request:
10+
# paths:
11+
# - '.github/workflows/docker-images.yml'
12+
# push:
13+
# branches:
14+
# - main
15+
# paths:
16+
# - '.github/workflows/docker-images.yml'
17+
#jobs:
18+
# buildx:
19+
# runs-on: ubuntu-latest
20+
# steps:
21+
# - name: Set up QEMU
22+
# uses: docker/setup-qemu-action@v3
23+
# - name: Set up Docker Buildx
24+
# uses: docker/setup-buildx-action@v3
25+
26+
jobs:
27+
build:
28+
runs-on: ${{ matrix.IMAGE.RUNNER }}
29+
timeout-minutes: 10
30+
permissions:
31+
contents: read
32+
packages: write
33+
id-token: write
34+
attestations: write
35+
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
IMAGE:
40+
- {
41+
TAG_NAME: "archlinux:latest",
42+
DOCKER_PLATFORM: "linux/loong64",
43+
DOCKERFILE_PATH: ".github/workflows",
44+
RUNNER: "ubuntu-latest",
45+
}
46+
47+
name: "${{ matrix.IMAGE.TAG_NAME }}"
48+
steps:
49+
- uses: actions/checkout@v4.2.2
50+
with:
51+
persist-credentials: false
52+
- name: Pull existing image
53+
run: docker pull ghcr.io/${{ github.repository_owner }}/${{ matrix.IMAGE.TAG_NAME }} || true
54+
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
55+
56+
- name: Setup environment variables
57+
shell: bash
58+
id: image-name
59+
run: |
60+
IMAGE_NAME=$(echo "${{ matrix.IMAGE.TAG_NAME }}" | cut -d ':' -f 1)
61+
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_OUTPUT
62+
- name: Setup QEMU
63+
uses: docker/setup-qemu-action@v3
64+
- name: Set up Docker Buildx
65+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
66+
with:
67+
cache-binary: false
68+
- name: Login to ghcr.io
69+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
70+
with:
71+
registry: ghcr.io
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'
75+
- name: Build docker image
76+
uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 # v6.17.0
77+
id: docker-build
78+
with:
79+
context: ${{ matrix.IMAGE.DOCKERFILE_PATH }}
80+
cache-from: ghcr.io/${{ github.repository_owner }}/${{ matrix.IMAGE.TAG_NAME }}
81+
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.IMAGE.TAG_NAME }}
82+
platforms: ${{ matrix.IMAGE.DOCKER_PLATFORM }}
83+
pull: true
84+
push: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' }}
85+
- name: Attese
86+
uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0
87+
with:
88+
subject-name: "ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}"
89+
subject-digest: ${{ steps.docker-build.outputs.digest }}
90+
push-to-registry: true
91+
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'

0 commit comments

Comments
 (0)