-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile.binary
More file actions
61 lines (50 loc) · 2.25 KB
/
Copy pathDockerfile.binary
File metadata and controls
61 lines (50 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Lightweight Dockerfile that runs linkspector using a pre-built binary
# from GitHub Releases. No Node.js or npm required.
#
# Build (defaults to latest release, auto-detects architecture):
# docker build -f Dockerfile.binary -t linkspector .
#
# Build a specific version:
# docker build -f Dockerfile.binary --build-arg LINKSPECTOR_VERSION=v0.5.2 -t linkspector .
#
# Run:
# docker run --rm -v "$PWD:/app" linkspector check
FROM debian:bookworm-slim
ARG LINKSPECTOR_VERSION=latest
ARG TARGETARCH
# Install Chromium and minimal dependencies
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
chromium \
curl \
git \
upower \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Set up Chromium for Puppeteer (same approach as the npm Dockerfile)
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium.wrapper
RUN echo '#!/bin/sh' > /usr/bin/chromium.wrapper \
&& echo 'exec /usr/bin/chromium --no-sandbox --headless=new --disable-gpu --enable-chrome-browser-cloud-management --remote-debugging-port=0 "$@"' >> /usr/bin/chromium.wrapper \
&& chmod ugo+x /usr/bin/chromium.wrapper
# Map Docker TARGETARCH to release asset names
# TARGETARCH is "amd64" or "arm64"; release assets use "x64" or "arm64"
RUN ARCH=$(case "${TARGETARCH}" in amd64) echo "x64" ;; arm64) echo "arm64" ;; *) echo "x64" ;; esac) \
&& if [ "${LINKSPECTOR_VERSION}" = "latest" ]; then \
URL="https://github.com/UmbrellaDocs/linkspector/releases/latest/download/linkspector-linux-${ARCH}"; \
else \
URL="https://github.com/UmbrellaDocs/linkspector/releases/download/${LINKSPECTOR_VERSION}/linkspector-linux-${ARCH}"; \
fi \
&& echo "Downloading ${URL}" \
&& curl -fSL -o /usr/local/bin/linkspector "${URL}" \
&& chmod +x /usr/local/bin/linkspector
# Create a non-root user
RUN useradd --create-home --shell /bin/bash linkspector
ENV USER=linkspector
# Create app directory for mounting host files
RUN mkdir /app && chown linkspector:linkspector /app
USER linkspector
WORKDIR /app
# Sanity check — verify the binary is executable
RUN linkspector --help > /dev/null 2>&1 || linkspector --version || true
ENTRYPOINT ["linkspector"]