Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirgate to ghcr.io #95

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apt-sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
MAINTAINER iBug <[email protected]>
RUN apk add --no-cache --update wget perl ca-certificates git python3 py3-requests && \
mkdir -p /usr/local/lib/tunasync
Expand Down
2 changes: 1 addition & 1 deletion aptsync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer="Jian Zeng <anonymousknight96 AT gmail.com>"
ENV APTSYNC_NTHREADS=20 \
APTSYNC_CREATE_DIR=true \
Expand Down
2 changes: 1 addition & 1 deletion archvsync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine-3.12
FROM ghcr.io/ustcmirror/base:alpine-3.12
LABEL maintainer="Jian Zeng <anonymousknight96 AT gmail.com>"
ENV BASEDIR=/usr/local
RUN apk add --no-cache rsync && mkdir -p "$BASEDIR/etc"
Expand Down
2 changes: 1 addition & 1 deletion archvsync/build
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
8 changes: 4 additions & 4 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,17 @@ 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):
n = path.basename(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):
Expand Down Expand Up @@ -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, '')
Expand Down
2 changes: 1 addition & 1 deletion crates-io-index/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Keyu Tao <taoky AT lug.ustc.edu.cn>"
RUN apk add --no-cache git
ADD sync.sh /
2 changes: 1 addition & 1 deletion curl-helper/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer="Yifan Gao [email protected]"
RUN apk add --no-cache curl coreutils grep findutils bash
ADD curl-helper.sh /
2 changes: 1 addition & 1 deletion debian-cd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine-3.12
FROM ghcr.io/ustcmirror/base:alpine-3.12
LABEL maintainer "Jian Zeng <anonymousknight96 AT gmail.com>"
VOLUME ["/debian"]
ADD ["sync.sh", "pre-sync.sh", "prepare.sh", "/"]
Expand Down
2 changes: 1 addition & 1 deletion debian-cd/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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'
taoky marked this conversation as resolved.
Show resolved Hide resolved
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-*
2 changes: 1 addition & 1 deletion docker-ce/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer="Keyu Tao <[email protected]>"
RUN apk add --no-cache --update wget perl ca-certificates git python3 py3-requests py3-pip py3-lxml && \
pip3 install pyquery && \
Expand Down
2 changes: 1 addition & 1 deletion fedora/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine-3.12
FROM ghcr.io/ustcmirror/base:alpine-3.12
LABEL maintainer "Shengjing Zhu <[email protected]>"
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 \
Expand Down
2 changes: 1 addition & 1 deletion freebsd-pkg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/curl-helper
FROM ghcr.io/ustcmirror/curl-helper
LABEL maintainer="Yifan Gao [email protected]"
RUN apk add --no-cache rsync parallel gawk sed xz tar jq bash
ADD sync.sh /
2 changes: 1 addition & 1 deletion freebsd-ports/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/gitsync
FROM ghcr.io/ustcmirror/gitsync
LABEL maintainer="Yifan Gao <[email protected]>"
RUN apk add --no-cache curl coreutils parallel gawk sed grep tar findutils bash
ADD sync-ports.sh /
Expand Down
2 changes: 1 addition & 1 deletion ghcup/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:debian
FROM ghcr.io/ustcmirror/base:debian
MAINTAINER Kai Ma <[email protected]>
ADD ["config", "sync.sh", "prepare.sh", "ghcupsync.hs", "ghcupsync.cabal", "/"]
RUN bash /prepare.sh && rm prepare.sh
2 changes: 1 addition & 1 deletion github-release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Yulong Ming <[email protected]>"
RUN apk add --no-cache python3 py3-requests py3-yaml && \
mkdir -p /usr/local/lib/tunasync
Expand Down
2 changes: 1 addition & 1 deletion gitsync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Jian Zeng <anonymousknight96 AT gmail.com>"
RUN apk add --no-cache git
ADD sync.sh /
2 changes: 1 addition & 1 deletion google-repo/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Keyu Tao <taoky AT lug.ustc.edu.cn>"
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 && \
Expand Down
2 changes: 1 addition & 1 deletion gsutil-rsync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Yao Wei (魏銘廷) <[email protected]>"

RUN apk add --no-cache python3 py-setuptools openssl libffi && \
Expand Down
2 changes: 1 addition & 1 deletion hackage/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
MAINTAINER Jiahao Li <[email protected]>
ENV HACKAGE_BASE_URL=https://hackage.haskell.org
RUN apk add --no-cache wget ca-certificates coreutils
Expand Down
2 changes: 1 addition & 1 deletion homebrew-bottles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]"
RUN apk add --no-cache parallel bash sed gzip
ADD sync.sh /
Expand Down
2 changes: 1 addition & 1 deletion julia-storage/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion lftpsync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Jian Zeng <anonymousknight96 AT gmail.com>"
RUN apk add --no-cache lftp ca-certificates
ADD sync.sh /
2 changes: 1 addition & 1 deletion misc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Keyu Tao <taoky AT ustclug.org>"
RUN apk add --no-cache wget
ADD sync.sh /
2 changes: 1 addition & 1 deletion nix-channels/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 12 additions & 8 deletions push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion pypi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
MAINTAINER Yifan Gao <[email protected]>
ENV PYPI_MASTER=https://pypi.python.org \
BANDERSNATCH_WORKERS=3 \
Expand Down
2 changes: 1 addition & 1 deletion rclone/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Jian Zeng <anonymousknight96 AT gmail.com>"

ARG RCLONE_VERSION=v1.50.2
Expand Down
4 changes: 2 additions & 2 deletions rsync/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <anonymousknight96 AT gmail.com>"
RUN apk add --no-cache rsync openssh-client
ADD sync.sh /
Expand Down
2 changes: 1 addition & 1 deletion rubygems/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
MAINTAINER Yifan Gao <[email protected]>
ENV UPSTREAM=http://rubygems.org
RUN apk add --no-cache ruby ca-certificates && \
Expand Down
2 changes: 1 addition & 1 deletion stackage/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:debian
FROM ghcr.io/ustcmirror/base:debian
MAINTAINER Jiahao Li <[email protected]>
ADD ["config", "sync.sh", "prepare.sh", "stackage.hs", "/"]
RUN bash /prepare.sh && rm prepare.sh
2 changes: 1 addition & 1 deletion test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "Jian Zeng <anonymousknight96 AT gmail.com>"
ADD sync.sh /
2 changes: 1 addition & 1 deletion winget-source/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ustcmirror/base:alpine
FROM ghcr.io/ustcmirror/base:alpine
LABEL maintainer "YR Chen <[email protected]>"

RUN apk add --no-cache nodejs
Expand Down
4 changes: 2 additions & 2 deletions yum-sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
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 && \
Expand Down