refactor: switch to filiph/linkcheck
Some checks reported errors
continuous-integration/drone/pr Build was killed
Some checks reported errors
continuous-integration/drone/pr Build was killed
This commit is contained in:
parent
b94579b1a7
commit
afd31dc03e
18
.drone.yml
18
.drone.yml
@ -27,6 +27,20 @@ platform:
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: binary
|
||||
image: dart:stable
|
||||
commands:
|
||||
- apt-get -qq update && apt-get install -yqq --no-install-recommends make
|
||||
- make build
|
||||
|
||||
- name: verify
|
||||
image: thegeeklab/alpine-tools
|
||||
commands:
|
||||
- src/build/linkcheck/linkcheck --help
|
||||
- src/build/linkcheck/linkcheck --version
|
||||
depends_on:
|
||||
- binary
|
||||
|
||||
- name: dryrun
|
||||
image: thegeeklab/drone-docker-buildx:20
|
||||
settings:
|
||||
@ -42,6 +56,8 @@ steps:
|
||||
when:
|
||||
ref:
|
||||
- refs/pull/**
|
||||
depends_on:
|
||||
- verify
|
||||
|
||||
- name: tags
|
||||
image: thegeeklab/docker-autotag
|
||||
@ -153,7 +169,7 @@ steps:
|
||||
DOCKER_USER:
|
||||
from_secret: docker_username
|
||||
PUSHRM_FILE: README.md
|
||||
PUSHRM_SHORT: Custom image for broken-link-checker
|
||||
PUSHRM_SHORT: Custom image for linkcheck
|
||||
PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
|
||||
when:
|
||||
status:
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
CHANGELOG.md
|
||||
/src
|
||||
|
41
Dockerfile
41
Dockerfile
@ -1,4 +1,4 @@
|
||||
FROM node:lts-alpine3.15@sha256:1a9a71ea86aad332aa7740316d4111ee1bd4e890df47d3b5eff3e5bded3b3d10
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
||||
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
||||
@ -8,34 +8,33 @@ LABEL org.opencontainers.image.source="https://gitea.rknet.org/docker/link-valid
|
||||
LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/docker/link-validator"
|
||||
|
||||
ARG BUILD_VERSION
|
||||
# renovate: datasource=npm depName=broken-link-checker
|
||||
ENV BLC_VERSION="${BUILD_VERSION:-0.7.8}"
|
||||
ARG WAIT_FOR_VERSION
|
||||
ARG CONTAINER_LIBRARY
|
||||
|
||||
|
||||
# renovate: datasource=github-releases depName=caddyserver/caddy
|
||||
ENV CADDY_VERSION="${CADDY_VERSION:-v2.5.1}"
|
||||
ENV CADDY_VERSION="${BUILD_VERSION:-v2.5.1}"
|
||||
# renovate: datasource=github-releases depName=thegeeklab/wait-for
|
||||
ENV WAIT_FOR_VERSION="${WAIT_FOR_VERSION:-v0.2.0}"
|
||||
# renovate: datasource=git-tags depName=https://gitea.rknet.org/docker/container-library
|
||||
ENV CONTAINER_LIBRARY="${CONTAINER_LIBRARY:-v0.1.3}"
|
||||
|
||||
ENV LINK_VALIDATOR_BASE_DIR=/drone/src \
|
||||
LINK_VALIDATOR_SERVER_PORT=80 \
|
||||
FORCE_COLOR=true \
|
||||
NPM_CONFIG_LOGLEVEL=error
|
||||
LINK_VALIDATOR_SERVER_PORT=8000
|
||||
|
||||
COPY overlay/ /
|
||||
|
||||
RUN echo "Installing requirements ..." && \
|
||||
apk --update add --virtual .build-deps curl && \
|
||||
RUN apt-get update && apt-get install -y curl bash ncat media-types && \
|
||||
curl -SsL "https://gitea.rknet.org/docker/container-library/releases/download/${CONTAINER_LIBRARY}/container-library.tar.gz" | tar xz -C / && \
|
||||
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 && \
|
||||
curl -SsL -o /usr/local/bin/wait-for "https://github.com/thegeeklab/wait-for/releases/download/${WAIT_FOR_VERSION}/wait-for" && \
|
||||
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 \
|
||||
echo "Installing link-checker version '$BLC_VERSION' ..." && \
|
||||
npm install -g broken-link-checker@"$BLC_VERSION"; \
|
||||
else \
|
||||
echo "Installing latest link-checker ..." && \
|
||||
npm install -g broken-link-checker; \
|
||||
fi && \
|
||||
apk del .build-deps && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
rm -rf /tmp/*
|
||||
chmod 755 /usr/local/bin/wait-for && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /tmp/* && \
|
||||
rm -rf /root/.cache/
|
||||
|
||||
ADD src/build/linkcheck/linkcheck /usr/local/bin/linkcheck
|
||||
|
||||
USER root
|
||||
CMD []
|
||||
|
29
Makefile
Normal file
29
Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
# renovate: datasource=github-tags depName=filiph/linkcheck
|
||||
export BUILD_VERSION ?= 2.0.22
|
||||
export PATH := $(PATH):$(HOME)/.pub-cache/bin
|
||||
|
||||
SRC := src
|
||||
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
.PHONY: build
|
||||
build: build-src build-bin
|
||||
|
||||
.PHONY: build-src
|
||||
build-src:
|
||||
mkdir -p $(SRC); \
|
||||
curl -sSL "https://github.com/filiph/linkcheck/archive/$${BUILD_VERSION##v}.tar.gz" | tar xz -C $(SRC) --strip-components=1
|
||||
|
||||
.PHONY: build-bin
|
||||
build-bin:
|
||||
dart --disable-analytics --version; \
|
||||
cd $(SRC); \
|
||||
dart pub get; \
|
||||
dart pub global activate grinder; \
|
||||
grind pkg-standalone-linux-x64; \
|
||||
tar xzf build/linkcheck-*-linux-x64.tar.gz -C ./build
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(SRC)
|
@ -1,6 +1,6 @@
|
||||
# link-validator
|
||||
|
||||
Custom image for broken-link-checker
|
||||
Custom image for linkcheck
|
||||
|
||||
[![Build Status](https://img.shields.io/drone/build/docker/link-validator?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/docker/link-validator)
|
||||
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/link-validator)
|
||||
@ -8,16 +8,16 @@ Custom image for broken-link-checker
|
||||
[![Source: Gitea](https://img.shields.io/badge/source-gitea-blue.svg?logo=gitea&logoColor=white)](https://gitea.rknet.org/docker/link-validator)
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/docker/link-validator/src/branch/main/LICENSE)
|
||||
|
||||
Custom wrapper Docker image for [broken-link-checker](https://github.com/stevenvachon/broken-link-checker) optimized for CI.
|
||||
Custom wrapper Docker image for [linkcheck](https://github.com/filiph/linkcheck/) optimized for CI.
|
||||
|
||||
## Usage
|
||||
|
||||
```Shell
|
||||
docker run -v $(pwd)/public:/drone/src link-validator
|
||||
|
||||
# or pass arguments to broken-link-checker
|
||||
# or pass arguments to linkcheck
|
||||
# ... but DO NOT set the server url! This will be done automatically. See environment variables.
|
||||
docker run -v $(pwd)/public:/drone/src link-validator -ro
|
||||
docker run -v $(pwd)/public:/drone/src link-validator -e
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
|
@ -1,5 +1,16 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
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"
|
||||
# shellcheck disable=SC1091
|
||||
. /usr/local/lib/log.sh
|
||||
|
||||
URL="127.0.0.1:$LINK_VALIDATOR_SERVER_PORT"
|
||||
|
||||
caddy file-server --root "$LINK_VALIDATOR_BASE_DIR" --listen "$URL" &
|
||||
|
||||
log_info "Wait for web server on '$URL'"
|
||||
/usr/local/bin/wait-for "$URL"
|
||||
|
||||
log_info "Start linkcheck"
|
||||
exec /usr/local/bin/linkcheck "$@" "$URL"
|
||||
|
Reference in New Issue
Block a user