forked from Mailu/Mailu
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (35 loc) · 1.29 KB
/
mirror.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Used for creating mirror images of images currently on docker.io.
# The main reason is to circumvent the docker pull rate-limit
# Currently this is used for:
# Alpine (used in Dockerfile for base image)
name: mirror-images
on:
workflow_dispatch:
inputs:
tag:
description: 'The tag of the docker.io/alpine image that is mirrored as ghcr.io/mailu/alpine'
required: true
type: string
jobs:
# mirror alpine image
mirror-image-alpine:
runs-on: ubuntu-latest
steps:
- name: Helper to convert docker org to lowercase
id: string
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository_owner }}
- name: Mirror images
shell: bash
env:
DOCKER_ORG: ghcr.io/${{ steps.string.outputs.lowercase }}
TAG: ${{ inputs.tag }}
run: |
set -euxo pipefail \
; echo "${{ github.token }}" | docker login --username "${{ github.repository_owner }}" --password-stdin ghcr.io \
; curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 >regctl \
; chmod 755 regctl \
; ./regctl image copy docker.io/alpine:"$TAG" "$DOCKER_ORG"/alpine:"$TAG" \
; rm regctl \
; docker logout ghcr.io