1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-12 10:45:38 +02:00
Mailu/.github/workflows/mirror.yml
Dimitri Huisman c829cd90a0
Adapt mirror.yml that it can only be run manually
When starting it manually, you can provide the tag that must be synchronised
2023-03-28 21:02:57 +02:00

38 lines
1.3 KiB
YAML

# 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