diff --git a/rubygems/Dockerfile b/rubygems/Dockerfile index 6dd8a7a..7b7782b 100644 --- a/rubygems/Dockerfile +++ b/rubygems/Dockerfile @@ -1,6 +1,6 @@ FROM ustcmirror/base:alpine LABEL maintainer="Yifan Gao " -ENV UPSTREAM=http://rubygems.org +ENV UPSTREAM=https://rubygems.org RUN apk add --no-cache ruby ca-certificates && \ gem install --no-document rubygems-mirror ADD sync.sh pre-sync.sh / diff --git a/rubygems/sync.sh b/rubygems/sync.sh index 864dc96..6da4657 100755 --- a/rubygems/sync.sh +++ b/rubygems/sync.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -x + export HOME=/root cat << EOF > /root/.gem/.mirrorrc --- @@ -10,4 +12,11 @@ cat << EOF > /root/.gem/.mirrorrc delete: false skiperror: true EOF + +# Fetch index +wget -qO "$TO/versions.new" "$UPSTREAM/versions" +md5sum "$TO/versions.new" > "$TO/versions.md5sum.new" +mv -f "$TO/versions.new" "$TO/versions" +mv -f "$TO/versions.md5sum.new" "$TO/versions.md5sum" + exec gem mirror