diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f74cfb2..e8a1afc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,14 @@ jobs: COMMIT_FROM: ${{ github.event.before }} COMMIT_TO: ${{ github.event.after }} + - name: Login to ghcr + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + if: "github.ref == 'refs/heads/master' && github.repository == 'ustclug/ustcmirror-images'" + with: + registry: "ghcr.io" + username: ${{ secrets.GH_USER }} + password: ${{ secrets.GH_TOKEN }} + - name: Deploy if: "github.ref == 'refs/heads/master' && github.repository == 'ustclug/ustcmirror-images'" run: ./push.sh diff --git a/apt-sync/Dockerfile b/apt-sync/Dockerfile index 3cdc833..fb68026 100644 --- a/apt-sync/Dockerfile +++ b/apt-sync/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine MAINTAINER iBug RUN apk add --no-cache --update wget perl ca-certificates git python3 py3-requests && \ mkdir -p /usr/local/lib/tunasync diff --git a/aptsync/Dockerfile b/aptsync/Dockerfile index 8146693..5f49ab3 100644 --- a/aptsync/Dockerfile +++ b/aptsync/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer="Jian Zeng " ENV APTSYNC_NTHREADS=20 \ APTSYNC_CREATE_DIR=true \ diff --git a/archvsync/Dockerfile b/archvsync/Dockerfile index 772f31b..df69b07 100644 --- a/archvsync/Dockerfile +++ b/archvsync/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine-3.12 +FROM ghcr.io/ustcmirror/base:alpine-3.12 LABEL maintainer="Jian Zeng " ENV BASEDIR=/usr/local RUN apk add --no-cache rsync && mkdir -p "$BASEDIR/etc" diff --git a/archvsync/build b/archvsync/build index d9df0ac..b9f65f9 100755 --- a/archvsync/build +++ b/archvsync/build @@ -5,4 +5,4 @@ set -e cd upstream git apply ../update.patch cp bin/{common,ftpsync} .. -docker build -t ustcmirror/archvsync .. +docker build -t ghcr.io/ustcmirror/archvsync .. diff --git a/configure.py b/configure.py index 9961981..2e39e42 100755 --- a/configure.py +++ b/configure.py @@ -229,7 +229,7 @@ def strip_prefix(s, prefix): def encode_tag(tag): - return strip_prefix(tag, 'ustcmirror/').replace(':', '.') + return strip_prefix(tag, 'ghcr.io/ustcmirror/').replace(':', '.') def get_dest_image(img, f): @@ -237,9 +237,9 @@ def get_dest_image(img, f): # tag may contain a dot tag = strip_prefix(n, 'Dockerfile') if tag: - return 'ustcmirror/{}:{}'.format(img, tag[1:]) + return 'ghcr.io/ustcmirror/{}:{}'.format(img, tag[1:]) else: - return 'ustcmirror/{}:latest'.format(img) + return 'ghcr.io/ustcmirror/{}:latest'.format(img) def get_base_image(f): @@ -281,7 +281,7 @@ def main(): with Builder() as b: for dst, base in imgs.items(): - if base.startswith('ustcmirror'): + if base.startswith('ghcr.io/ustcmirror'): b.add(dst, base) else: b.add(dst, '') diff --git a/crates-io-index/Dockerfile b/crates-io-index/Dockerfile index e406794..8fb4958 100644 --- a/crates-io-index/Dockerfile +++ b/crates-io-index/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Keyu Tao " RUN apk add --no-cache git ADD sync.sh / diff --git a/curl-helper/Dockerfile b/curl-helper/Dockerfile index ed8c2c8..da195ae 100644 --- a/curl-helper/Dockerfile +++ b/curl-helper/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer="Yifan Gao docker@yfgao.com" RUN apk add --no-cache curl coreutils grep findutils bash ADD curl-helper.sh / diff --git a/debian-cd/Dockerfile b/debian-cd/Dockerfile index 6980b40..00c8761 100644 --- a/debian-cd/Dockerfile +++ b/debian-cd/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine-3.12 +FROM ghcr.io/ustcmirror/base:alpine-3.12 LABEL maintainer "Jian Zeng " VOLUME ["/debian"] ADD ["sync.sh", "pre-sync.sh", "prepare.sh", "/"] diff --git a/debian-cd/prepare.sh b/debian-cd/prepare.sh index af9c9ed..7bc9fb4 100755 --- a/debian-cd/prepare.sh +++ b/debian-cd/prepare.sh @@ -2,7 +2,8 @@ set -e apk add --no-cache wget ca-certificates rsync mkdir -p /etc/jigdo -wget 'http://atterer.org/sites/atterer/files/2009-08/jigdo/jigdo-bin-0.7.3.tar.bz2' +wget 'https://ftp.lug.ustc.edu.cn/misc/jigdo-bin-0.7.3.tar.bz2' +echo "58b8a6885822e55f365c99131c906f16ceaaf657c566e10f410d026704cad157 jigdo-bin-0.7.3.tar.bz2" | sha256sum -c - tar xf jigdo-bin-0.7.3.tar.bz2 jigdo-bin-0.7.3/jigdo-file mv jigdo-bin-0.7.3/jigdo-file /usr/local/bin/ rm -rf jigdo-bin-* diff --git a/docker-ce/Dockerfile b/docker-ce/Dockerfile index a4e1135..8c8ad94 100644 --- a/docker-ce/Dockerfile +++ b/docker-ce/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer="Keyu Tao " RUN apk add --no-cache --update wget perl ca-certificates git python3 py3-requests py3-pip py3-lxml && \ pip3 install pyquery && \ diff --git a/fedora/Dockerfile b/fedora/Dockerfile index 5042bdf..3ab8ac3 100644 --- a/fedora/Dockerfile +++ b/fedora/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine-3.12 +FROM ghcr.io/ustcmirror/base:alpine-3.12 LABEL maintainer "Shengjing Zhu " RUN apk add --no-cache zsh curl rsync ca-certificates gawk grep bzip2 coreutils diffutils findutils \ && curl -fLo /usr/local/bin/quick-fedora-mirror https://pagure.io/quick-fedora-mirror/raw/master/f/quick-fedora-mirror \ diff --git a/freebsd-pkg/Dockerfile b/freebsd-pkg/Dockerfile index 26dc59e..6ff0128 100644 --- a/freebsd-pkg/Dockerfile +++ b/freebsd-pkg/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/curl-helper +FROM ghcr.io/ustcmirror/curl-helper LABEL maintainer="Yifan Gao docker@yfgao.com" RUN apk add --no-cache rsync parallel gawk sed xz tar jq bash ADD sync.sh / diff --git a/freebsd-ports/Dockerfile b/freebsd-ports/Dockerfile index 0f80b23..6d302c3 100644 --- a/freebsd-ports/Dockerfile +++ b/freebsd-ports/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/gitsync +FROM ghcr.io/ustcmirror/gitsync LABEL maintainer="Yifan Gao " RUN apk add --no-cache curl coreutils parallel gawk sed grep tar findutils bash ADD sync-ports.sh / diff --git a/ghcup/Dockerfile b/ghcup/Dockerfile index 12e40c3..cd7923f 100644 --- a/ghcup/Dockerfile +++ b/ghcup/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:debian +FROM ghcr.io/ustcmirror/base:debian MAINTAINER Kai Ma ADD ["config", "sync.sh", "prepare.sh", "ghcupsync.hs", "ghcupsync.cabal", "/"] RUN bash /prepare.sh && rm prepare.sh diff --git a/github-release/Dockerfile b/github-release/Dockerfile index 067f58c..4943fa2 100644 --- a/github-release/Dockerfile +++ b/github-release/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Yulong Ming " RUN apk add --no-cache python3 py3-requests py3-yaml && \ mkdir -p /usr/local/lib/tunasync diff --git a/gitsync/Dockerfile b/gitsync/Dockerfile index 247913b..a36e1fb 100644 --- a/gitsync/Dockerfile +++ b/gitsync/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Jian Zeng " RUN apk add --no-cache git ADD sync.sh / diff --git a/google-repo/Dockerfile b/google-repo/Dockerfile index 3b2b71c..ea239da 100644 --- a/google-repo/Dockerfile +++ b/google-repo/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Keyu Tao " RUN apk add --no-cache git curl python3 openssh-client gnupg && \ curl -fLo /usr/local/bin/repo https://storage.googleapis.com/git-repo-downloads/repo && \ diff --git a/gsutil-rsync/Dockerfile b/gsutil-rsync/Dockerfile index f1f6c76..843d021 100644 --- a/gsutil-rsync/Dockerfile +++ b/gsutil-rsync/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Yao Wei (魏銘廷) " RUN apk add --no-cache python3 py-setuptools openssl libffi && \ diff --git a/hackage/Dockerfile b/hackage/Dockerfile index c8c4d1c..93e030a 100644 --- a/hackage/Dockerfile +++ b/hackage/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine MAINTAINER Jiahao Li ENV HACKAGE_BASE_URL=https://hackage.haskell.org RUN apk add --no-cache wget ca-certificates coreutils diff --git a/homebrew-bottles/Dockerfile b/homebrew-bottles/Dockerfile index 9487ab2..5888966 100644 --- a/homebrew-bottles/Dockerfile +++ b/homebrew-bottles/Dockerfile @@ -4,7 +4,7 @@ COPY bottles-json . RUN apk add --no-cache musl-dev RUN cargo build --release -FROM ustcmirror/curl-helper +FROM ghcr.io/ustcmirror/curl-helper LABEL maintainer="Yifan Gao docker@yfgao.com" RUN apk add --no-cache parallel bash sed gzip ADD sync.sh / diff --git a/julia-storage/Dockerfile b/julia-storage/Dockerfile index 654c380..83b4b45 100644 --- a/julia-storage/Dockerfile +++ b/julia-storage/Dockerfile @@ -1,5 +1,5 @@ # Ref: https://github.com/tuna/tunasync-scripts/tree/master/dockerfiles/julia -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine ENV JULIA_DEPOT_PATH="/opt/julia/depot" RUN apk update && apk add --no-cache curl python3 gnupg py3-pip && \ diff --git a/lftpsync/Dockerfile b/lftpsync/Dockerfile index c3a6887..d798724 100644 --- a/lftpsync/Dockerfile +++ b/lftpsync/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Jian Zeng " RUN apk add --no-cache lftp ca-certificates ADD sync.sh / diff --git a/misc/Dockerfile b/misc/Dockerfile index f4fe7e9..93ac2cf 100644 --- a/misc/Dockerfile +++ b/misc/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Keyu Tao " RUN apk add --no-cache wget ADD sync.sh / diff --git a/nix-channels/Dockerfile b/nix-channels/Dockerfile index 42f16e2..1fe8de4 100644 --- a/nix-channels/Dockerfile +++ b/nix-channels/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine RUN \ # Install Nix. To simplify management we only copy binaries and create diff --git a/push.sh b/push.sh index 63d6f20..31557ff 100755 --- a/push.sh +++ b/push.sh @@ -2,18 +2,22 @@ [[ $DEBUG = true ]] && set -x -if [[ $GITHUB_EVENT_NAME != push && $GITHUB_EVENT_NAME != schedule ]]; then - exit 0 -fi -if [[ $GITHUB_EVENT_NAME == push && $GITHUB_REF != "refs/heads/master" ]]; then - exit 0 -fi +case $GITHUB_EVENT_NAME in + push|schedule|workflow_dispatch) + if [[ $GITHUB_REF != "refs/heads/master" ]]; then + exit 0 + fi + ;; + *) + exit 0 + ;; +esac [[ -z $SKIP_LOGIN ]] && docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" for image in $(docker images --filter=label=org.ustcmirror.images=true --format="{{.Repository}}:{{.Tag}}") do - docker push "$image" - echo "$image pushed" + docker push "$image" && echo "$image pushed to ghcr.io" + docker tag "$image" "docker.io/${image##ghcr.io/}" && docker push "docker.io/${image##ghcr.io/}" && echo "$image pushed to docker.io" done diff --git a/pypi/Dockerfile b/pypi/Dockerfile index 365405c..423b91b 100644 --- a/pypi/Dockerfile +++ b/pypi/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine MAINTAINER Yifan Gao ENV PYPI_MASTER=https://pypi.python.org \ BANDERSNATCH_WORKERS=3 \ diff --git a/rclone/Dockerfile b/rclone/Dockerfile index 1dfe91b..ef520bc 100644 --- a/rclone/Dockerfile +++ b/rclone/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Jian Zeng " ARG RCLONE_VERSION=v1.50.2 diff --git a/rsync/Dockerfile b/rsync/Dockerfile index 87e9a10..6d93697 100644 --- a/rsync/Dockerfile +++ b/rsync/Dockerfile @@ -1,10 +1,10 @@ -FROM ustcmirror/base:alpine-3.12 AS builder +FROM ghcr.io/ustcmirror/base:alpine-3.12 AS builder RUN apk add --no-cache build-base WORKDIR /tmp ADD lchmod.c . RUN gcc -Wall -fPIC -shared -o lchmod.so lchmod.c -FROM ustcmirror/base:alpine-3.12 +FROM ghcr.io/ustcmirror/base:alpine-3.12 LABEL maintainer "Jian Zeng " RUN apk add --no-cache rsync openssh-client ADD sync.sh / diff --git a/rubygems/Dockerfile b/rubygems/Dockerfile index 8023fbf..96c6c38 100644 --- a/rubygems/Dockerfile +++ b/rubygems/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine MAINTAINER Yifan Gao ENV UPSTREAM=http://rubygems.org RUN apk add --no-cache ruby ca-certificates && \ diff --git a/stackage/Dockerfile b/stackage/Dockerfile index 7fab619..748899f 100644 --- a/stackage/Dockerfile +++ b/stackage/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:debian +FROM ghcr.io/ustcmirror/base:debian MAINTAINER Jiahao Li ADD ["config", "sync.sh", "prepare.sh", "stackage.hs", "/"] RUN bash /prepare.sh && rm prepare.sh diff --git a/test/Dockerfile b/test/Dockerfile index 15dad4d..28f958b 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -1,3 +1,3 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "Jian Zeng " ADD sync.sh / diff --git a/winget-source/Dockerfile b/winget-source/Dockerfile index 12201cf..a3eef02 100644 --- a/winget-source/Dockerfile +++ b/winget-source/Dockerfile @@ -1,4 +1,4 @@ -FROM ustcmirror/base:alpine +FROM ghcr.io/ustcmirror/base:alpine LABEL maintainer "YR Chen " RUN apk add --no-cache nodejs diff --git a/yum-sync/Dockerfile b/yum-sync/Dockerfile index 497ba22..a0e6c56 100644 --- a/yum-sync/Dockerfile +++ b/yum-sync/Dockerfile @@ -1,9 +1,9 @@ -FROM ustcmirror/base:debian AS builder +FROM ghcr.io/ustcmirror/base:debian AS builder COPY binder.c /tmp/binder.c RUN apt update && apt install -y build-essential && \ gcc -Wall -fPIC -shared -o /tmp/binder.so /tmp/binder.c -FROM ustcmirror/base:debian +FROM ghcr.io/ustcmirror/base:debian LABEL maintainer="Keyu Tao " RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/backports.list && \ apt update && apt install -y dnf createrepo-c dnf-plugins-core python3 python3-requests && \