update rubygems and the Dockerfile for rubygems

This commit is contained in:
bigeagle 2016-12-11 17:09:25 +08:00
parent d14fbb732b
commit a8426387fc
No known key found for this signature in database
GPG Key ID: 9171A4571C27920A
2 changed files with 24 additions and 26 deletions

View File

@ -0,0 +1,4 @@
FROM cybercode/alpine-ruby:2.3
RUN gem install rubygems-mirror
ENV BUSYBOX=1
volume /data

View File

@ -6,6 +6,7 @@ CONF="$HOME/.gem/.mirrorrc"
mkdir -p "$HOME/.gem" mkdir -p "$HOME/.gem"
INIT=${INIT:-"0"} INIT=${INIT:-"0"}
BUSYBOX=${BUSYBOX:-"0"}
if [ ! -d "$TUNASYNC_WORKING_DIR" ]; then if [ ! -d "$TUNASYNC_WORKING_DIR" ]; then
mkdir -p $TUNASYNC_WORKING_DIR mkdir -p $TUNASYNC_WORKING_DIR
@ -14,8 +15,6 @@ fi
echo "Syncing to $TUNASYNC_WORKING_DIR" echo "Syncing to $TUNASYNC_WORKING_DIR"
if [[ $INIT == "0" ]]; then
cat > $CONF << EOF cat > $CONF << EOF
--- ---
- from: https://rubygems.org - from: https://rubygems.org
@ -26,24 +25,19 @@ if [[ $INIT == "0" ]]; then
skiperror: true skiperror: true
EOF EOF
/usr/bin/timeout -s INT 7200 $GEM mirror if [[ $INT == "0" ]]; then
if [[ $? == 124 ]]; then if [[ $BUSYBOX == "0" ]]; then
echo 'Sync timeout (/_\\)' timeout -t 7200 -s INT $GEM mirror -V
exit 1
fi
else else
timeout -s INT 7200 $GEM mirror -V
cat > $CONF << EOF
---
- from: https://rubygems.org
to: ${TUNASYNC_WORKING_DIR}
parallelism: 10
retries: 2
delete: true
skiperror: true
EOF
$GEM mirror
fi fi
else
$GEM mirror -V
fi
ret=$?
if [[ $ret == 124 ]]; then
echo 'Sync timeout (/_\\)'
fi
exit $ret