From 88122811d917c6924f18408b2ccfeca7f32f2a36 Mon Sep 17 00:00:00 2001 From: NI Date: Sun, 11 Aug 2019 12:17:27 +0800 Subject: [PATCH] Formating, everything should be running as before. --- Dockerfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2d70335..64bc4f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,10 @@ COPY . /tmp/.build/sshwifty RUN set -ex && \ cd / && \ ls -l /tmp/.build/sshwifty && \ - echo "res=0; for i in \$(seq 0 36); do \$@; res=\$?; [ \$res -eq 0 ] && exit \$res || sleep 10; done; exit \$res" > /try.sh && chmod +x /try.sh && \ - echo "cpid=\"\"; ret=0; i=0; for c in \"\$@\"; do ( (((((eval \$c; echo \$? >&3) | sed \"s/^/|-(\$i) /\" >&4) 2>&1 | sed \"s/^/|-(\$i)!/\" >&2) 3>&1) | (read xs; exit \$xs)) 4>&1) & ppid=\$!; cpid=\"\$cpid \$ppid\"; echo \"+ Child \$i (PID \$ppid): \$c ...\"; i=\$((i+1)); done; for c in \$cpid; do wait \$c; cret=\$?; [ \$cret -eq 0 ] && continue; echo \"* Child PID \$c has failed.\" >&2; ret=\$cret; done; exit \$ret" > /child.sh && chmod +x /child.sh && \ + echo 'res=0; for i in $(seq 0 36); do $@; res=$?; [ $res -eq 0 ] && exit $res || sleep 10; done; exit $res' > /try.sh && chmod +x /try.sh && \ + echo 'cpid=""; ret=0; i=0; for c in "$@"; do ( (((((eval $c; echo $? >&3) | sed "s/^/|-($i) /" >&4) 2>&1 | sed "s/^/|-($i)!/" >&2) 3>&1) | (read xs; exit $xs)) 4>&1) & ppid=$!; cpid="$cpid $ppid"; echo "+ Child $i (PID $ppid): $c ..."; i=$((i+1)); done; for c in $cpid; do wait $c; cret=$?; [ $cret -eq 0 ] && continue; echo "* Child PID $c has failed." >&2; ret=$cret; done; exit $ret' > /child.sh && chmod +x /child.sh && \ export PATH=$PATH:/ && \ - echo "apt-get update && apt-get install npm golang-go git -y" > /install.sh && chmod +x /install.sh && \ + echo 'apt-get update && apt-get install npm golang-go git -y' > /install.sh && chmod +x /install.sh && \ ([ -z "$HTTP_PROXY" ] || (echo "Acquire::http::Proxy \"$HTTP_PROXY\";" >> /etc/apt/apt.conf)) && \ ([ -z "$HTTPS_PROXY" ] || (echo "Acquire::https::Proxy \"$HTTPS_PROXY\";" >> /etc/apt/apt.conf)) && \ try.sh install.sh && rm /install.sh @@ -20,8 +20,8 @@ RUN set -ex && \ ([ -z "$HTTP_PROXY" ] || (git config --global http.proxy "$HTTP_PROXY" && npm config set proxy "$HTTP_PROXY")) && \ ([ -z "$HTTPS_PROXY" ] || (git config --global https.proxy "$HTTPS_PROXY" && npm config set https-proxy "$HTTPS_PROXY")) && \ child.sh \ - "cd /tmp/.build/sshwifty && try.sh npm install" \ - "cd /tmp/.build/sshwifty && try.sh go mod download" + 'cd /tmp/.build/sshwifty && try.sh npm install' \ + 'cd /tmp/.build/sshwifty && try.sh go mod download' # Main building environment FROM libbase as builder @@ -53,9 +53,10 @@ ENV SSHWIFTY_HOSTNAME= \ SSHWIFTY_DOCKER_TLSCERTKEY= COPY --from=builder /sshwifty / RUN set -ex && \ - adduser -D "sshwifty" && \ + adduser -D sshwifty && \ chmod +x /sshwifty && \ - echo "#!/bin/sh" > /sshwifty.sh && echo >> /sshwifty.sh && echo "([ -z \"\$SSHWIFTY_DOCKER_TLSCERT\" ] || echo \"\$SSHWIFTY_DOCKER_TLSCERT\" > /cert); ([ -z \"\$SSHWIFTY_DOCKER_TLSCERTKEY\" ] || echo \"\$SSHWIFTY_DOCKER_TLSCERTKEY\" > /certkey); if [ -f \"/cert\" ] && [ -f \"/certkey\" ]; then su - sshwifty -c \"\$(export) && SSHWIFTY_TLSCERTIFICATEFILE=/cert SSHWIFTY_TLSCERTIFICATEKEYFILE=/certkey /sshwifty\"; else su - sshwifty -c \"\$(export) && /sshwifty\"; fi;" >> /sshwifty.sh && chmod +x /sshwifty.sh + echo '#!/bin/sh' > /sshwifty.sh && echo >> /sshwifty.sh && echo '([ -z "$SSHWIFTY_DOCKER_TLSCERT" ] || echo "$SSHWIFTY_DOCKER_TLSCERT" > /cert); ([ -z "$SSHWIFTY_DOCKER_TLSCERTKEY" ] || echo "$SSHWIFTY_DOCKER_TLSCERTKEY" > /certkey); if [ -f "/cert" ] && [ -f "/certkey" ]; then SSHWIFTY_TLSCERTIFICATEFILE=/cert SSHWIFTY_TLSCERTIFICATEKEYFILE=/certkey /sshwifty; else /sshwifty; fi;' >> /sshwifty.sh && chmod +x /sshwifty.sh +USER sshwifty EXPOSE 8182 ENTRYPOINT [ "/sshwifty.sh" ] CMD [] \ No newline at end of file