mirror of
https://github.com/casjaysdevdocker/deno
synced 2025-01-18 12:34:21 -05:00
🗃️ Committing everything that changed 🗃️
This commit is contained in:
parent
b4e47444f3
commit
26ce86d10e
55
Dockerfile
55
Dockerfile
@ -1,22 +1,34 @@
|
|||||||
#FROM casjaysdevdocker/debian:latest as build
|
#FROM casjaysdevdocker/debian:latest as build
|
||||||
FROM casjaysdevdocker/alpine:latest AS build
|
FROM casjaysdevdocker/alpine:latest AS build
|
||||||
|
|
||||||
ENV DENO_VERSION="v1.26.1" \
|
ARG alpine_version="v3.16" \
|
||||||
DEBIAN_FRONTEND=noninteractive
|
TIMEZONE="America/New_York" \
|
||||||
|
IMAGE_NAME="alpine" \
|
||||||
|
LICENSE="MIT" \
|
||||||
|
PORTS="1-65535"
|
||||||
|
|
||||||
RUN apt update && \
|
ENV TZ="$TIMEZONE" \
|
||||||
apt upgrade -yy && \
|
SHELL="/bin/bash" \
|
||||||
apt install unzip -yy && \
|
ENV="$HOME/.bashrc" \
|
||||||
apt clean && \
|
TERM="xterm-256color" \
|
||||||
rm -rf /var/lib/apt/lists/*
|
HOSTNAME="${HOSTNAME:-casjaysdev-$IMAGE_NAME}" \
|
||||||
|
DENO_VERSION="v1.26.1"
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
rm -Rf "/etc/apk/repositories"; \
|
||||||
|
echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/main" >> "/etc/apk/repositories"; \
|
||||||
|
echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/community" >> "/etc/apk/repositories"; \
|
||||||
|
if [ "$alpine_version" = "edge" ]; then echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/testing" >> "/etc/apk/repositories" ; fi ; \
|
||||||
|
apk update --update-cache && apk add \
|
||||||
|
unzip
|
||||||
|
|
||||||
COPY ./bin/. /usr/local/bin/
|
COPY ./bin/. /usr/local/bin/
|
||||||
COPY ./config/. /config/
|
COPY ./data/. /usr/local/share/template-files/data/
|
||||||
COPY ./data/. /data/
|
COPY ./config/. /usr/local/share/template-files/config/
|
||||||
|
|
||||||
RUN chmod -Rf 755 /usr/local/bin/get-deno.sh && \
|
RUN chmod -Rf 755 /usr/local/bin/get-deno.sh && \
|
||||||
DEBUG="true" /usr/local/bin/get-deno.sh && \
|
DEBUG="true" /usr/local/bin/get-deno.sh && \
|
||||||
rm -Rf /usr/local/bin/get-deno.sh
|
rm -Rf /usr/local/bin/get-deno.sh /bin/.gitkeep /config /data /var/cache/apk/*
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
@ -36,16 +48,23 @@ LABEL org.label-schema.name="deno" \
|
|||||||
maintainer="CasjaysDev <docker-admin@casjaysdev.com>"
|
maintainer="CasjaysDev <docker-admin@casjaysdev.com>"
|
||||||
|
|
||||||
ENV SHELL="/bin/bash" \
|
ENV SHELL="/bin/bash" \
|
||||||
|
ENV="$HOME/.bashrc" \
|
||||||
TERM="xterm-256color" \
|
TERM="xterm-256color" \
|
||||||
HOSTNAME="casjaysdev-deno" \
|
HOSTNAME="casjaysdev-alpine" \
|
||||||
TZ="${TZ:-America/New_York}"
|
TZ="${TZ:-America/New_York}" \
|
||||||
|
TIMEZONE="$TIMEZONE" \
|
||||||
WORKDIR /data
|
PHP_SERVER="none" \
|
||||||
VOLUME ["/data"]
|
PORT=""
|
||||||
EXPOSE 1-65535
|
|
||||||
|
|
||||||
COPY --from=build /. /
|
COPY --from=build /. /
|
||||||
|
|
||||||
HEALTHCHECK --interval=15s --timeout=3s CMD [ "/usr/local/bin/entrypoint-deno.sh", "healthcheck" ]
|
WORKDIR /data/htdocs/www
|
||||||
|
|
||||||
|
VOLUME [ "/config","/data" ]
|
||||||
|
|
||||||
|
EXPOSE $PORTS
|
||||||
|
|
||||||
|
ENTRYPOINT [ "tini", "-p", "SIGTERM", "--" ]
|
||||||
|
CMD [ "/usr/local/bin/entrypoint-deno.sh" ]
|
||||||
|
HEALTHCHECK --start-period=1m --interval=2m --timeout=3s CMD [ "/usr/local/bin/entrypoint-deno.sh", "healthcheck" ]
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/local/bin/entrypoint-deno.sh" ]
|
|
||||||
|
@ -47,9 +47,9 @@ fi
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
[[ -f "/config/.env" ]] && source /config/.env
|
[[ -f "/config/.env" ]] && source /config/.env
|
||||||
|
|
||||||
if [ -z "$1" ] && [ -z "$(ls -A "" 2>/dev/null)" ]; then
|
if [ -z "$1" ] && [ -z "$(ls -A "/data/htdocs/www" 2>/dev/null)" ]; then
|
||||||
FRESH_INSTALL="true"
|
FRESH_INSTALL="true"
|
||||||
deno run -A -r https://fresh.deno "/data/"
|
deno run -A -r https://fresh.deno "/data/htdocs/www"
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -67,13 +67,13 @@ sh | bash | shell | /bin/sh | /bin/bash)
|
|||||||
|
|
||||||
deno)
|
deno)
|
||||||
shift 1
|
shift 1
|
||||||
deno run --allow-net "${@:-/data/sample.ts}"
|
deno run --allow-net "${@:-/data/htdocs/www/sample.ts}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ "$FRESH_INSTALL" = "true" ]; then
|
if [ "$FRESH_INSTALL" = "true" ]; then
|
||||||
deno --allow-all task start
|
deno --allow-all task start
|
||||||
else
|
else
|
||||||
deno run --watch --allow-all "${@:-/data/sample.ts}"
|
deno run --watch --allow-all "${@:-/data/htdocs/www/sample.ts}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -18,18 +18,19 @@
|
|||||||
[ -n "$DEBUG" ] && set -x
|
[ -n "$DEBUG" ] && set -x
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
DENO_VERSION="${DENO_VERSION:-v1.26.1}"
|
DENO_VERSION="${DENO_VERSION:-v1.26.1}"
|
||||||
DENO_URL_x64="https://github.com/denoland/deno/releases/download/latest/deno-x86_64-unknown-linux-gnu.zip"
|
DENO_URL_x64_LATEST="https://github.com/denoland/deno/releases/download/latest/deno-x86_64-unknown-linux-gnu.zip"
|
||||||
DENO_URL_ARM64="https://github.com/LukeChannings/deno-arm64/releases/latest/download/deno-linux-arm64.zip"
|
DENO_URL_x64_VERSION="https://github.com/denoland/deno/releases/download/$DENO_VERSION/deno-x86_64-unknown-linux-gnu.zip"
|
||||||
|
DENO_URL_ARM64_LATEST="https://github.com/LukeChannings/deno-arm64/releases/latest/download/deno-linux-arm64.zip"
|
||||||
|
DENO_URL_ARM64_VERSION="https://github.com/LukeChannings/deno-arm64/releases/download/$DENO_VERSION/deno-linux-arm64.zip"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
__get_file() {
|
__get_file() {
|
||||||
local version_url="${URL//latest/$DENO_VERSION/}"
|
if curl -q -LSsf -o "$FILE" "$URL"||false; then
|
||||||
if curl -q -LSSf -o "$FILE" "$URL"; then
|
|
||||||
DOWNLOAD_URL="$URL"
|
|
||||||
return 0
|
return 0
|
||||||
elif curl -q -LSsf -o "$FILE" "$version_url"; then
|
elif curl -q -LSsf -o "$FILE" "$LATEST_URL"||false; then
|
||||||
DOWNLOAD_URL="$version_url"
|
URL="$LATEST_URL"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -37,8 +38,14 @@ __get_file() {
|
|||||||
# AMD64 binary
|
# AMD64 binary
|
||||||
if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "x86_64" ]; then
|
if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "x86_64" ]; then
|
||||||
ARCH=x86_64
|
ARCH=x86_64
|
||||||
URL="$DENO_URL_x64"
|
|
||||||
FILE="/tmp/deno-$ARCH.zip"
|
FILE="/tmp/deno-$ARCH.zip"
|
||||||
|
LATEST_URL="$DENO_URL_x64_LATEST"
|
||||||
|
if [ "$DENO_VERSION" = "latest" ] || [ -z "$DENO_VERSION" ]; then
|
||||||
|
DENO_VERSION="latest"
|
||||||
|
URL="$DENO_URL_x64_LATEST"
|
||||||
|
else
|
||||||
|
URL="$DENO_URL_x64_VERSION"
|
||||||
|
fi
|
||||||
echo "grabbing ${DENO_VERSION}/deno-x86_64-unknown-linux-gnu.zip from denoland for $ARCH"
|
echo "grabbing ${DENO_VERSION}/deno-x86_64-unknown-linux-gnu.zip from denoland for $ARCH"
|
||||||
__get_file && if [ -f "/tmp/deno-$ARCH.zip" ]; then
|
__get_file && if [ -f "/tmp/deno-$ARCH.zip" ]; then
|
||||||
mkdir -p "/tmp/deno-$ARCH" && cd "/tmp/deno-$ARCH" || exit 10
|
mkdir -p "/tmp/deno-$ARCH" && cd "/tmp/deno-$ARCH" || exit 10
|
||||||
@ -48,15 +55,21 @@ if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "x86_64" ]; then
|
|||||||
rm -Rf "/tmp/deno-$ARCH.zip" "/tmp/deno-$ARCH"
|
rm -Rf "/tmp/deno-$ARCH.zip" "/tmp/deno-$ARCH"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Failed to download deno from $DOWNLOAD_URL"
|
echo "Failed to download deno from $URL"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# ARM64 binary
|
# ARM64 binary
|
||||||
if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then
|
if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then
|
||||||
ARCH=arm64
|
ARCH=arm64
|
||||||
URL="$DENO_URL_ARM64"
|
|
||||||
FILE="/tmp/deno-$ARCH.zip"
|
FILE="/tmp/deno-$ARCH.zip"
|
||||||
|
LATEST_URL="$DENO_URL_ARM64_LATEST"
|
||||||
|
if [ "$DENO_VERSION" = "latest" ] || [ -z "$DENO_VERSION" ]; then
|
||||||
|
DENO_VERSION="latest"
|
||||||
|
URL="$DENO_URL_ARM64_LATEST"
|
||||||
|
else
|
||||||
|
URL="$DENO_URL_ARM64_VERSION"
|
||||||
|
fi
|
||||||
echo "grabbing ${DENO_VERSION}/deno-linux-arm64.zip from LukeChannings for $ARCH"
|
echo "grabbing ${DENO_VERSION}/deno-linux-arm64.zip from LukeChannings for $ARCH"
|
||||||
__get_file && if [ -f "/tmp/deno-$ARCH.zip" ]; then
|
__get_file && if [ -f "/tmp/deno-$ARCH.zip" ]; then
|
||||||
mkdir -p "/tmp/deno-$ARCH" && cd "/tmp/deno-$ARCH" || exit 10
|
mkdir -p "/tmp/deno-$ARCH" && cd "/tmp/deno-$ARCH" || exit 10
|
||||||
@ -66,7 +79,7 @@ if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then
|
|||||||
rm -Rf "/tmp/deno-$ARCH.zip" "/tmp/deno-$ARCH"
|
rm -Rf "/tmp/deno-$ARCH.zip" "/tmp/deno-$ARCH"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Failed to download deno from $DOWNLOAD_URL"
|
echo "Failed to download deno from $URL"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
[ -f "$(which "deno")" ] && deno upgrade && exit 0 || exit 10
|
[ -f "$(which "deno")" ] && deno upgrade && exit 0 || exit 10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user