diff --git a/Dockerfile b/Dockerfile index 9ded5fa..c7a1d33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ RUN set -ex; \ dpkg-reconfigure --frontend=noninteractive locales && \ update-locale LANG=en_US.UTF-8 && \ git clone -q "https://github.com/casjay-templates/denojs" "${DEFAULT_DATA_DIR}/htdocs/www" && \ - cd "${DEFAULT_DATA_DIR}/htdocs/www" && /usr/local/bin/get-deno.sh + /usr/local/bin/get-deno.sh RUN echo 'Running cleanup' ; \ apt-get clean ; \ diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 79b02da..6377fd0 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -205,7 +205,7 @@ fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Copy /config to /etc if [ -d "/config" ]; then - echo "Copying /config to /etc" + [ "$DATA_DIR_INITIALIZED" = "false" ] && echo "Copying /config to /etc" for create_conf in /config/*; do if [ -n "$create_conf" ]; then create_conf_name="$(basename "$create_conf")" diff --git a/rootfs/usr/local/bin/get-deno.sh b/rootfs/usr/local/bin/get-deno.sh index d839536..95d17a6 100755 --- a/rootfs/usr/local/bin/get-deno.sh +++ b/rootfs/usr/local/bin/get-deno.sh @@ -43,10 +43,11 @@ if curl -q -LSsf -o "$TMP_FILE" "$URL" && [ -f "$TMP_FILE" ]; then mkdir -p "$TMP_DIR" && cd "$TMP_DIR" || exit 10 unzip -q "$TMP_FILE" if [ -f "$TMP_DIR/deno" ]; then - cp -Rf "$TMP_DIR/deno" "$BIN_FILE" && chmod -Rf 755 "$BIN_FILE" || exit 10 + cp -Rf "$TMP_DIR/deno" "$BIN_FILE" && chmod -Rf 755 "$BIN_FILE" || exitCode=10 + [ -f "$BIN_FILE" ] && $BIN_FILE upgrade && exitCode=0 || exitCode=10 else echo "Failed to extract deno from $TMP_FILE" - exit 10 + exitCode=10 fi else echo "Failed to download deno from $URL" @@ -55,5 +56,4 @@ fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -Rf "$TMP_FILE" "$TMP_DIR" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[ -f "$BIN_FILE" ] && $BIN_FILE upgrade && exit 0 || exit 10 exit ${exitCode:-0} diff --git a/rootfs/usr/local/bin/start-deno.sh b/rootfs/usr/local/bin/start-deno.sh index 45cd1d7..fde02d2 100755 --- a/rootfs/usr/local/bin/start-deno.sh +++ b/rootfs/usr/local/bin/start-deno.sh @@ -81,7 +81,7 @@ CONTAINER_IP_ADDRESS="$(ip a 2>/dev/null | grep 'inet' | grep -v '127.0.0.1' | a #SERVICE_PORT="" SERVICE_NAME="deno" SERVICE_COMMAND="$SERVICE_NAME" -export exec_message="Starting $SERVICE_NAME on $CONTAINER_IP_ADDRESS:$SERVICE_PORT" +export exec_message="Starting $SERVICE_NAME on $CONTAINER_IP_ADDRESS" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Pre copy commands @@ -156,6 +156,7 @@ deno) if __pgrep "$SERVICE_NAME" && [ ! -f "/tmp/$SERVICE_NAME.pid" ]; then echo "$SERVICE_NAME is running" else + echo "$exec_message" && exec_message="" touch "/tmp/$SERVICE_NAME.pid" if [ -n "$START_SCRIPT" ]; then RUN_SCRIPT="$START_SCRIPT" @@ -168,7 +169,6 @@ deno) elif [ -f "server.ts" ]; then RUN_SCRIPT="server.ts" fi - echo "Attempting to start deno" __exec_command "$SERVICE_COMMAND" task start || __exec_command "$SERVICE_COMMAND" run --watch --allow-all "${@:-$RUN_SCRIPT}" || { rm -Rf "/tmp/$SERVICE_NAME.pid"