fix: replace outdated node web server by caddy
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Robert Kaussow 2020-12-30 18:46:58 +01:00
parent 7bd2cc6c80
commit d163a866fe
Signed by: xoxys
GPG Key ID: 65362AE74AF98B61
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,4 @@
FROM node:10-alpine@sha256:bb33b8ee56dd6b28960fbc4bc4610b8b74e1e9869e844f903a7e47ea1caf20b3
# due to https://github.com/http-party/http-server/issues/537
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
@ -11,6 +10,8 @@ LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/docker/lin
ARG BUILD_VERSION
# renovate: datasource=npm depName=broken-link-checker
ENV BLC_VERSION="${BUILD_VERSION:-0.7.8}"
# renovate: datasource=github-releases depName=caddyserver/caddy
ENV CADDY_VERSION="${CADDY_VERSION:-v2.2.1}"
ENV LINK_VALIDATOR_BASE_DIR=/drone/src \
LINK_VALIDATOR_SERVER_PORT=80 \
@ -20,7 +21,9 @@ ENV LINK_VALIDATOR_BASE_DIR=/drone/src \
COPY overlay/ /
RUN echo "Installing requirements ..." && \
npm install -g http-server && \
apk --update add --virtual .build-deps curl && \
curl -sSL "https://github.com/caddyserver/caddy/releases/download/${CADDY_VERSION}/caddy_${CADDY_VERSION##v}_linux_amd64.tar.gz" | tar xz -C /usr/local/bin caddy && \
chmod 755 /usr/local/bin/caddy && \
BLC_VERSION="${BLC_VERSION##v}" && \
BLC_MAJOR="${BLC_VERSION%%.*}" && \
if [ -z "${BLC_MAJOR//[0-9]}" ] && [ -n "$BLC_MAJOR" ]; then \
@ -30,6 +33,7 @@ RUN echo "Installing requirements ..." && \
echo "Installing latest link-checker ..." && \
npm install -g broken-link-checker; \
fi && \
apk del .build-deps && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/*

View File

@ -1,5 +1,5 @@
#!/usr/bin/env sh
set -eo pipefail
/usr/local/bin/http-server "$LINK_VALIDATOR_BASE_DIR" -p "$LINK_VALIDATOR_SERVER_PORT" -a 127.0.0.1 -s &
caddy file-server --root "$LINK_VALIDATOR_BASE_DIR" --listen "127.0.0.1:$LINK_VALIDATOR_SERVER_PORT" &> /dev/null &
exec /usr/local/bin/broken-link-checker "$@" http://localhost:"$LINK_VALIDATOR_SERVER_PORT"