🗃️ Committing everything that changed 🗃️

This commit is contained in:
casjay 2022-10-12 21:15:38 -04:00
parent ed1c5e839f
commit bc7440e7af
No known key found for this signature in database
GPG Key ID: 4F765975C1F0EE5F
2 changed files with 15 additions and 10 deletions

View File

@ -14,19 +14,21 @@ ENV TZ="$TIMEZONE" \
BUN_INSTALL="/usr/local/share/bun" BUN_INSTALL="/usr/local/share/bun"
RUN set -ex; \ RUN set -ex; \
mkdir -p "/usr/local/share/template-files/data/htdocs/www" && \
rm -Rf "/etc/apk/repositories"; \ 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/main" >> "/etc/apk/repositories"; \
echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/community" >> "/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 ; \ if [ "$alpine_version" = "edge" ]; then echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/testing" >> "/etc/apk/repositories" ; fi ; \
apk update --update-cache && \ apk update --update-cache && \
curl -fsSL https://bun.sh/install | bash && \ curl -fsSL https://bun.sh/install | bash && \
ln -sf /usr/local/share/bun/bun /usr/local/bin ln -sf /usr/local/share/bun/bun /usr/local/bin && \
git clone -q "https://github.com/casjay-templates/bunjs" "/usr/local/share/template-files/data/htdocs/www"
COPY ./bin/. /usr/local/bin/ COPY ./bin/. /usr/local/bin/
COPY ./data/. /usr/local/share/template-files/data/ COPY ./data/. /usr/local/share/template-files/data/
COPY ./config/. /usr/local/share/template-files/config/ COPY ./config/. /usr/local/share/template-files/config/
RUN rm -Rf /bin/.gitkeep /config /data /var/cache/apk/* RUN rm -Rf /bin/.gitkeep /config /data /var/cache/apk/* /usr/local/share/template-files/data/htdocs/www/.git
FROM scratch FROM scratch
ARG BUILD_DATE="2022-10-12" \ ARG BUILD_DATE="2022-10-12" \
@ -60,7 +62,7 @@ ENV SHELL="/bin/bash" \
COPY --from=build /. / COPY --from=build /. /
WORKDIR /data WORKDIR /data/htdocs/www
VOLUME [ "/config","/data" ] VOLUME [ "/config","/data" ]
@ -69,4 +71,3 @@ EXPOSE $PORTS
ENTRYPOINT [ "tini", "-p", "SIGTERM", "--" ] ENTRYPOINT [ "tini", "-p", "SIGTERM", "--" ]
CMD [ "/usr/local/bin/entrypoint-bun.sh" ] CMD [ "/usr/local/bin/entrypoint-bun.sh" ]
HEALTHCHECK --start-period=1m --interval=2m --timeout=3s CMD [ "/usr/local/bin/entrypoint-bun.sh", "healthcheck" ] HEALTHCHECK --start-period=1m --interval=2m --timeout=3s CMD [ "/usr/local/bin/entrypoint-bun.sh", "healthcheck" ]

View File

@ -119,10 +119,10 @@ if [ ! -e "/config/$APPNAME" ] && [ -e "$DEFAULT_CONF_DIR/$APPNAME" ]; then
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setup bun # Setup bun
mkdir -p "/data" && cd "/data" || exit 10 mkdir -p "/data/htdocs/www" && cd "/data/htdocs/www" || exit 10
if [ -z "$1" ] && [ -z "$(ls -A "/app"/* 2>/dev/null)" ]; then if [ -z "$1" ] && [ -z "$(ls -A "/data/htdocs/www"/* 2>/dev/null)" ]; then
mkdir -p "/data" && cd "/data" cp -Rf "/usr/local/share/template-files/data/htdocs/www/." "/data/htdocs/www/"
bun upgrade && bun init RUN_SCRIPT="src/index.ts"
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Additional commands # Additional commands
@ -155,7 +155,11 @@ bun)
*) # Execute primary command *) # Execute primary command
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f "index.ts" ]; then if [ -n "$RUN_SCRIPT" ]; then
START_SCRIPT="$RUN_SCRIPT"
elif [ -f "src/index.ts" ]; then
RUN_SCRIPT="index.ts"
elif [ -f "index.ts" ]; then
RUN_SCRIPT="index.ts" RUN_SCRIPT="index.ts"
elif [ -f "app.ts" ]; then elif [ -f "app.ts" ]; then
RUN_SCRIPT="app.ts" RUN_SCRIPT="app.ts"
@ -163,7 +167,7 @@ bun)
RUN_SCRIPT="server.ts" RUN_SCRIPT="server.ts"
fi fi
bun install bun install
bun dev $RUN_SCRIPT bun dev ${START:-$START_SCRIPT}
exit ${exitCode:-$?} exit ${exitCode:-$?}
else else
__exec_command "$@" __exec_command "$@"