diff --git a/Dockerfile b/Dockerfile index fb4b0ed..45f1373 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,8 @@ ENV TZ="$TIMEZONE" \ ENV="$HOME/.bashrc" \ TERM="xterm-256color" \ HOSTNAME="${HOSTNAME:-casjaysdev-$IMAGE_NAME}" \ - DEBUG="${DEBUG}" \ - DENO_VERSION="${DENO_VERSION}" + DEBUG="$DEBUG" \ + DENO_VERSION="$DENO_VERSION" RUN set -ex; \ rm -Rf "/etc/apk/repositories"; \ @@ -31,7 +31,7 @@ COPY ./config/. /usr/local/share/template-files/config/ RUN chmod -Rf 755 /usr/local/bin/get-deno.sh && \ /usr/local/bin/get-deno.sh && \ - rm -Rf /usr/local/bin/get-deno.sh /bin/.gitkeep /config /data /var/cache/apk/* + rm -Rf /usr/local/bin/get-deno.sh /tmp/* /bin/.gitkeep /config /data /var/cache/apk/* FROM scratch diff --git a/bin/get-deno.sh b/bin/get-deno.sh index c32a4aa..43114ef 100755 --- a/bin/get-deno.sh +++ b/bin/get-deno.sh @@ -21,36 +21,35 @@ DENO_VERSION="${DENO_VERSION:-v1.26.1}" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "x86_64" ]; then ARCH="x86_64" + CHANNEL="denoland" URL="https://github.com/denoland/deno/releases/download/$DENO_VERSION/deno-$ARCH-unknown-linux-gnu.zip" BIN_FILE="/usr/bin/deno" TMP_DIR="/tmp/deno-$ARCH" TMP_FILE="/tmp/deno-$ARCH.zip" - message="grabbing $DENO_VERSION from denoland for $ARCH" - err_mess="Failed to download deno from $URL" elif [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then ARCH="arm64" + CHANNEL="LukeChannings" URL="https://github.com/LukeChannings/deno-arm64/releases/download/$DENO_VERSION/deno-linux-$ARCH.zip" BIN_FILE="/usr/bin/deno" TMP_DIR="/tmp/deno-$ARCH" TMP_FILE="/tmp/deno-$ARCH.zip" - message="grabbing $DENO_VERSION from LukeChannings for $ARCH" - err_mess="Failed to download deno from $URL" else echo "Unsupported architecture" exit 1 fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -echo "$message" +echo "grabbing deno $DENO_VERSION from $CHANNEL for $ARCH" if curl -q -LSsf -o "$TMP_FILE" "$URL" && [ -f "$TMP_FILE" ]; then mkdir -p "$TMP_DIR" && cd "$TMP_DIR" || exit 10 unzip "$TMP_FILE" mv -fv "$TMP_DIR/deno" "$BIN_FILE" chmod -Rf 755 "$BIN_FILE" else - echo "$err_mess" - exit 2 + echo "Failed to download deno from $URL" + exitCode=2 fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -Rf "$TMP_FILE" "$TMP_DIR" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[ -f "$(which "deno" 2>/dev/null)" ] && deno upgrade && exit 0 || exit 10 +[ -f "$BIN_FILE" ] && $BIN_FILE upgrade && exit 0 || exit 10 +exit ${exitCode:-0}