Files
speedboard/Dockerfile
Malin 59c2403f43 fix: replace broken symlink with REPORTS_DIR env var
The ln -sf /data/reports /app/reports was creating the symlink INSIDE
/app/reports/ (since that dir already existed from COPY) instead of
replacing it. Result: sitespeed.io wrote to /app/reports/<id> and the
parser looked there too, but the volume was at /data/reports.

Fix: set REPORTS_DIR=/data/reports in Docker ENV and use it in both
runner.js (outputFolder) and app.js (static serving). No symlink needed.
Also add .dockerignore to exclude reports/, node_modules/, .git/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 10:49:20 +02:00

43 lines
1.7 KiB
Docker

# ─────────────────────────────────────────────────────────────────────────────
# Speedboard Docker image
#
# Based on the official sitespeed.io image which already includes:
# - Node.js 20
# - Chrome & Firefox (headless)
# - Xvfb
# - sitespeed.io CLI
# ─────────────────────────────────────────────────────────────────────────────
FROM sitespeedio/sitespeed.io:latest
WORKDIR /app
# Copy speedboard app files
COPY package.json ./
RUN npm install --omit=dev
COPY . .
RUN chmod +x /app/start.sh
# Locate sitespeed.js at build time and write the path to /sitespeed_env.
# The base image sets sitespeed.io as ENTRYPOINT via a full path, so it is
# not on $PATH. We find it once here so start.sh can export it at runtime.
RUN SITESPEED_JS=$(find / -name 'sitespeed.js' -path '*/bin/*' 2>/dev/null | head -1); \
echo "Build-time sitespeed.js found at: $SITESPEED_JS"; \
echo "export SITESPEED_BIN=$SITESPEED_JS" > /sitespeed_env
# Create the persistent data directories (volume mount points)
RUN mkdir -p /data/reports /data/db
# Runtime env — REPORTS_DIR and DB_PATH point to the mounted volumes
ENV PORT=3132 \
IN_DOCKER=1 \
REPORTS_DIR=/data/reports \
NODE_ENV=production
EXPOSE 3132
# start.sh boots Xvfb (virtual display for Chrome/Firefox) then runs the app.
# This mirrors what the base image's own entrypoint does.
ENTRYPOINT ["/app/start.sh"]