Skip to content

Commit

Permalink
feat: adopt modern Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Jian Zeng <[email protected]>
  • Loading branch information
knight42 committed Aug 13, 2024
1 parent df02b49 commit b443de8
Show file tree
Hide file tree
Showing 19 changed files with 110 additions and 60 deletions.
5 changes: 4 additions & 1 deletion apt-sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM ustcmirror/base:alpine
LABEL maintainer="iBug <[email protected]>"
LABEL bind_support=true
RUN apk add --no-cache --update wget perl ca-certificates git python3 py3-requests && \
RUN <<EOF
set -euo pipefail
apk add --no-cache --update wget perl ca-certificates git python3 py3-requests
mkdir -p /usr/local/lib/tunasync
EOF
ADD tunasync /usr/local/lib/tunasync
ADD sync.sh sync.py /
8 changes: 5 additions & 3 deletions aptsync/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ LABEL bind_support=true
ENV APTSYNC_NTHREADS=20 \
APTSYNC_CREATE_DIR=true \
APTSYNC_UNLINK=0
RUN apk add --no-cache --update wget perl ca-certificates xz \
&& mkdir -p /var/spool/apt-mirror/mirror /var/spool/apt-mirror/skel /etc/apt/
RUN <<EOF
set -euo pipefail
apk add --no-cache --update wget perl ca-certificates xz
mkdir -p /var/spool/apt-mirror/mirror /var/spool/apt-mirror/skel /etc/apt/
EOF
ADD ["apt-mirror", "/usr/local/bin/apt-mirror"]
RUN chmod +x /usr/local/bin/apt-mirror
ADD ["pre-sync.sh", "sync.sh", "/"]
Empty file modified aptsync/apt-mirror
100644 → 100755
Empty file.
5 changes: 4 additions & 1 deletion base/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM alpine:3.20
LABEL maintainer="Jian Zeng <anonymousknight96 AT gmail.com>" \
org.ustcmirror.images=true
RUN apk add --no-cache bash tzdata su-exec && \
RUN <<EOF
set -euo pipefail
apk add --no-cache bash tzdata su-exec
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
EOF
ADD ["entry.sh", "savelog", "/usr/local/bin/"]
ADD ["pip.conf", "/etc/"]
VOLUME ["/data", "/log"]
Expand Down
5 changes: 4 additions & 1 deletion base/Dockerfile.alpine-edge
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM alpine:edge
LABEL maintainer="Yifan Gao<git AT yfgao.com>" \
org.ustcmirror.images=true
RUN apk add --no-cache bash tzdata su-exec && \
RUN <<EOF
set -euo pipefail
apk add --no-cache bash tzdata su-exec
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
EOF
ADD ["entry.sh", "savelog", "/usr/local/bin/"]
VOLUME ["/data", "/log"]
CMD ["entry.sh"]
17 changes: 12 additions & 5 deletions base/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
FROM debian:bookworm-slim
LABEL maintainer="Jian Zeng <anonymousknight96 AT gmail.com>" \
org.ustcmirror.images=true
RUN echo 'Asia/Shanghai' > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata && \
apt-get update && apt-get install -y wget && \
wget -O /usr/local/bin/su-exec https://ftp.lug.ustc.edu.cn/misc/su-exec && chmod +x /usr/local/bin/su-exec && \
echo "592f25c51d0e4c90945ece8c4fa35018d20a1091ac109c98b66eb95deef211c7 /usr/local/bin/su-exec" | sha256sum -c - && \
apt-get purge -y --auto-remove wget && rm -rf /var/lib/apt/lists/*
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,sharing=locked,target=/var/lib/apt <<EOF

set -euo pipefail
echo 'Asia/Shanghai' > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
apt-get update && apt-get install -y wget
wget -O /usr/local/bin/su-exec https://ftp.lug.ustc.edu.cn/misc/su-exec
chmod +x /usr/local/bin/su-exec
echo "592f25c51d0e4c90945ece8c4fa35018d20a1091ac109c98b66eb95deef211c7 /usr/local/bin/su-exec" | sha256sum -c -
apt-get purge -y --auto-remove wget
EOF
ADD ["entry.sh", "savelog", "/usr/local/bin/"]
VOLUME ["/data", "/log"]
CMD ["entry.sh"]
8 changes: 5 additions & 3 deletions docker-ce/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM 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 && \
mkdir -p /usr/local/lib/tunasync
RUN <<EOF
set -euo pipefail
apk add --no-cache --update wget perl ca-certificates git python3 py3-requests py3-pip py3-lxml
pip3 install pyquery
EOF
ADD tunasync /usr/local/lib/tunasync
ADD sync.sh /
9 changes: 6 additions & 3 deletions fedora/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM ustcmirror/base:alpine
LABEL maintainer="Shengjing Zhu <[email protected]>"
LABEL bind_support=true
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 \
&& chmod +x /usr/local/bin/quick-fedora-mirror
RUN <<EOF
set -euo pipefail
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
chmod +x /usr/local/bin/quick-fedora-mirror
EOF
ADD ["pre-sync.sh", "sync.sh", "/"]
3 changes: 1 addition & 2 deletions github-release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM ustcmirror/base:alpine
LABEL maintainer="Yulong Ming <[email protected]>"
LABEL bind_support=true
RUN apk add --no-cache python3 py3-requests py3-yaml && \
mkdir -p /usr/local/lib/tunasync
RUN apk add --no-cache python3 py3-requests py3-yaml
ADD tunasync /usr/local/lib/tunasync
ADD sync.sh /
7 changes: 5 additions & 2 deletions google-repo/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM 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 && \
RUN <<EOF
set -euo pipefail
apk add --no-cache git curl python3 openssh-client gnupg
curl -fLo /usr/local/bin/repo https://storage.googleapis.com/git-repo-downloads/repo
chmod +x /usr/local/bin/repo
EOF
ADD ["pre-sync.sh", "sync.sh", "/"]
9 changes: 5 additions & 4 deletions gsutil-rsync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM ustcmirror/base:alpine
LABEL maintainer="Yao Wei (魏銘廷) <[email protected]>"

RUN apk add --no-cache python3 py-setuptools openssl libffi && \
apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev py3-pip openssl-dev libffi-dev && \
pip3 install --upgrade pip && \
RUN <<EOF
set -euo pipefail
apk add --no-cache python3 py-setuptools openssl libffi py3-pip
pip3 install --upgrade pip
pip3 --no-cache-dir install gsutil

EOF
ADD pre-sync.sh sync.sh /
13 changes: 8 additions & 5 deletions julia-storage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
FROM ustcmirror/base:alpine

ENV JULIA_DEPOT_PATH="/opt/julia/depot"
RUN apk update && apk add --no-cache curl python3 gnupg py3-pip && \
pip3 install jill && jill install 1.5 --confirm && \
ln -s /opt/julias/julia-1.5 /opt/julia && \
julia -e 'using Pkg; pkg"add [email protected]"' && \
chmod a+rx -R $JULIA_DEPOT_PATH
RUN <<EOF
apk update
apk add --no-cache curl python3 gnupg py3-pip
pip3 install jill && jill install 1.5 --confirm
ln -s /opt/julias/julia-1.5 /opt/julia
julia -e 'using Pkg; pkg"add [email protected]"'
chmod a+rx -R $JULIA_DEPOT_PATH
EOF

ADD startup.jl /opt/julia/etc/julia/startup.jl
ADD ["pre-sync.sh", "sync.sh", "/"]
20 changes: 11 additions & 9 deletions nix-channels/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
FROM ustcmirror/base:alpine

RUN \
RUN <<EOF
set -euo pipefail
# Install Nix. To simplify management we only copy binaries and create
# symlinks, and do no further configuration
wget https://nixos.org/releases/nix/nix-2.3.2/nix-2.3.2-x86_64-linux.tar.xz -O /tmp/nix.tar.xz && \
mkdir /tmp/nix.unpack && \
tar xpf /tmp/nix.tar.xz -C /tmp/nix.unpack && \
mkdir /nix && \
cp -dpr /tmp/nix.unpack/*/store /nix/store && \
ln -s /nix/store/*-nix-*/bin/* /usr/local/bin && \
rm -rf /tmp/nix.tar.xz /tmp/nix.unpack && \
wget https://nixos.org/releases/nix/nix-2.3.2/nix-2.3.2-x86_64-linux.tar.xz -O /tmp/nix.tar.xz
mkdir /tmp/nix.unpack
tar xpf /tmp/nix.tar.xz -C /tmp/nix.unpack
mkdir /nix
cp -dpr /tmp/nix.unpack/*/store /nix/store
ln -s /nix/store/*-nix-*/bin/* /usr/local/bin
rm -rf /tmp/nix.tar.xz /tmp/nix.unpack
# ca-certificates required by nix
apk add --no-cache ca-certificates python3 py3-requests py3-pip py3-lxml py3-tz && \
apk add --no-cache ca-certificates python3 py3-requests py3-pip py3-lxml py3-tz
pip3 install pyquery minio==6.0.2
EOF

ADD [ "sync.sh", "nix-channels.py", "/" ]
7 changes: 5 additions & 2 deletions pypi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ ENV PYPI_MASTER=https://pypi.python.org \
BANDERSNATCH_WORKERS=3 \
BANDERSNATCH_STOP_ON_ERROR=true \
BANDERSNATCH_TIMEOUT=20
RUN apk add --no-cache python3 python3-dev py3-pip musl-dev gcc libxml2 libxslt libxml2-dev libxslt-dev && \
pip3 --no-cache-dir install bandersnatch && \
RUN <<EOF
set -euo pipefail
apk add --no-cache python3 python3-dev py3-pip musl-dev gcc libxml2 libxslt libxml2-dev libxslt-dev
pip3 --no-cache-dir install bandersnatch
apk del --purge python3-dev musl-dev gcc libxml2-dev libxslt-dev
EOF
ADD sync.sh pre-sync.sh /
11 changes: 7 additions & 4 deletions rclone/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ ARG RCLONE_VERSION=v1.50.2
ENV RCLONE_DELETE_AFTER=true \
RCLONE_DELETE_EXCLUDED=true

RUN apk add --no-cache wget ca-certificates && \
cd /tmp/ && wget -q "https://downloads.rclone.org/$RCLONE_VERSION/rclone-$RCLONE_VERSION-linux-amd64.zip" && \
unzip /tmp/rclone*.zip && \
mv /tmp/rclone-*/rclone /usr/local/bin/ && \
RUN <<EOF
set -euo pipefail
apk add --no-cache wget ca-certificates
cd /tmp/ && wget -q "https://downloads.rclone.org/$RCLONE_VERSION/rclone-$RCLONE_VERSION-linux-amd64.zip"
unzip /tmp/rclone*.zip
mv /tmp/rclone-*/rclone /usr/local/bin/
rm -rf /tmp/* && apk del wget
EOF

ADD sync.sh /
11 changes: 7 additions & 4 deletions shadowmire/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ FROM ustcmirror/base:alpine
LABEL maintainer="Keyu Tao <taoky AT ustclug.org>"
ARG COMMIT=0a6a958e49ed1ce287596f04414fc21faf4ffac8

RUN apk add --no-cache wget ca-certificates python3 py3-click py3-requests py3-tqdm && \
cd /tmp/ && wget -q "https://raw.githubusercontent.com/taoky/shadowmire/$COMMIT/shadowmire.py" && \
mv /tmp/shadowmire.py /usr/local/bin/shadowmire && \
chmod +x /usr/local/bin/shadowmire && \
RUN <<EOF
set -euo pipefail
apk add --no-cache wget ca-certificates python3 py3-click py3-requests py3-tqdm
cd /tmp/ && wget -q "https://raw.githubusercontent.com/taoky/shadowmire/$COMMIT/shadowmire.py"
mv /tmp/shadowmire.py /usr/local/bin/shadowmire
chmod +x /usr/local/bin/shadowmire
rm -rf /tmp/* && apk del wget
EOF

ADD sync.sh /
11 changes: 7 additions & 4 deletions tsumugu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ LABEL maintainer="Keyu Tao <taoky AT ustclug.org>"
LABEL bind_support=true
ARG TSUMUGU_VERSION=20240811

RUN apk add --no-cache wget ca-certificates && \
cd /tmp/ && wget -q "https://github.com/taoky/tsumugu/releases/download/${TSUMUGU_VERSION}/tsumugu" && \
mv /tmp/tsumugu /usr/local/bin/ && \
chmod +x /usr/local/bin/tsumugu && \
RUN <<EOF
set -euo pipefail
apk add --no-cache wget ca-certificates
cd /tmp/ && wget -q "https://github.com/taoky/tsumugu/releases/download/${TSUMUGU_VERSION}/tsumugu"
mv /tmp/tsumugu /usr/local/bin/
chmod +x /usr/local/bin/tsumugu
rm -rf /tmp/* && apk del wget
EOF

ADD sync.sh /
10 changes: 7 additions & 3 deletions winget-source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ LABEL bind_support=true
RUN apk add --no-cache nodejs

ADD ["package.json", "package-lock.json", "/"]
RUN apk add --no-cache npm python3 && \
npm ci --prefix / --only=production && \
npm cache clean --force && \
RUN <<EOF
set -euo pipefail
apk add --no-cache npm python3
npm ci --prefix / --only=production
npm cache clean --force
apk del --purge --no-cache npm python3
EOF
RUN

ADD ["sync.sh", "sync-repo.js", "sysexits.js", "utilities.js", "/"]
11 changes: 7 additions & 4 deletions yukina/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ LABEL maintainer="Keyu Tao <taoky AT ustclug.org>"
LABEL bind_support=true
ARG YUKINA_VERSION=20240811

RUN apk add --no-cache wget ca-certificates zstd && \
cd /tmp/ && wget -q "https://github.com/taoky/yukina/releases/download/${YUKINA_VERSION}/yukina" && \
mv /tmp/yukina /usr/local/bin/ && \
chmod +x /usr/local/bin/yukina && \
RUN <<EOF
set -euo pipefail
apk add --no-cache wget ca-certificates zstd
cd /tmp/ && wget -q "https://github.com/taoky/yukina/releases/download/${YUKINA_VERSION}/yukina"
mv /tmp/yukina /usr/local/bin/
chmod +x /usr/local/bin/yukina
rm -rf /tmp/* && apk del wget
EOF

ADD sync.sh /

0 comments on commit b443de8

Please sign in to comment.