Skip to content

Commit 64c2229

Browse files
committed
Add basic mirroring.
Signed-off-by: Felix Fontein <[email protected]>
0 parents  commit 64c2229

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

.github/workflows/mirror.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: Mirror container images
3+
4+
'on':
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
# Run weekly (Monday at 11:32 UTC)
13+
schedule:
14+
- cron: '32 11 * * 1'
15+
16+
jobs:
17+
push:
18+
name: Mirror ${{ matrix.image }}:${{ matrix.tag }}
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
image:
23+
- ''
24+
tag:
25+
- ''
26+
source_image:
27+
- ''
28+
platform:
29+
- ''
30+
exclude:
31+
- image: ''
32+
include:
33+
- image: vault
34+
tag: 1.10.0
35+
source_image: docker.io/library/vault:1.10.0
36+
platform: linux/amd64
37+
- image: local-kms
38+
tag: 3.11.1
39+
source_image: docker.io/nsmithuk/local-kms:3.11.1
40+
platform: linux/amd64
41+
max-parallel: 4
42+
fail-fast: false
43+
permissions:
44+
contents: read
45+
packages: write
46+
attestations: write
47+
id-token: write
48+
steps:
49+
- name: Install dependencies
50+
run: |
51+
sudo apt-get install podman
52+
53+
- name: Build ${{ matrix.image }}:${{ matrix.tag }}
54+
env:
55+
SOURCE_IMAGE: ${{ matrix.source_image }}
56+
DESTINATION_REPO: ${{ github.repository }}
57+
DESTINATION_NAME: ${{ matrix.image }}:${{ matrix.tag }}
58+
PLATFORM: ${{ matrix.platform }}
59+
run: >
60+
echo
61+
"FROM ${SOURCE_IMAGE}"
62+
|
63+
podman
64+
build
65+
--platform
66+
"${PLATFORM}"
67+
--annotation
68+
"org.opencontainers.image.source=https://github.com/${DESTINATION_REPO}"
69+
-t
70+
"ghcr.io/${DESTINATION_REPO}/${DESTINATION_NAME}"
71+
-
72+
73+
- name: Push ${{ matrix.image }}:${{ matrix.tag }} to GHCR
74+
if: github.event_name != 'pull_request'
75+
uses: redhat-actions/push-to-registry@v2
76+
with:
77+
registry: ghcr.io/${{ github.repository }}
78+
image: ${{ matrix.image }}
79+
tags: ${{ matrix.tag }}
80+
username: ${{ github.actor }}
81+
password: ${{ secrets.GITHUB_TOKEN }}

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Container Images Mirror for SOPS' CI
2+
3+
This repository mirrors certain container images of upstream applications that are used in SOPS' CI.
4+
5+
## Purpose
6+
7+
This is to get around rate-limiting of other container registries (like Docker Hub), which currently disrupts SOPS' CI from time to time.

0 commit comments

Comments
 (0)