- Remove SingleFile CLI and Node.js from Dockerfile; runtime base reverted to alpine:3.21 - Replace triggerBrowseSnapshot with triggerDirectScrape: plain Go HTTP GET to novelfire.net (page is server-rendered, no browser needed) - Fix Accept-Encoding bug: stop setting header manually so Go transport auto-decompresses gzip - Add in-memory browse cache fallback (browseMemCache) for when MinIO and upstream both fail - Add warmBrowseCache() startup goroutine - Call triggerDirectScrape on MinIO cache hits too, so PocketBase ranking records are repopulated after a schema reset or fresh deploy without waiting for a cache miss - Fix grid view cards: wrap in <a> instead of <div> so clicking navigates to book detail - Remove SINGLEFILE_PATH and BROWSERLESS_URL env vars from Dockerfile
44 lines
1.5 KiB
Docker
44 lines
1.5 KiB
Docker
# ── Build stage ────────────────────────────────────────────────────────────────
|
|
FROM golang:1.25-alpine AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
# Cache dependency downloads separately from source compilation.
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
go build -ldflags="-s -w" -o /scraper ./cmd/scraper
|
|
|
|
# ── Runtime stage ──────────────────────────────────────────────────────────────
|
|
FROM alpine:3.21
|
|
|
|
# ca-certificates: HTTPS to novelfire.net
|
|
# tzdata: timezone data
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /scraper /app/scraper
|
|
|
|
# Create the default static output directory.
|
|
RUN mkdir -p /app/static/books
|
|
|
|
# Non-root user.
|
|
RUN addgroup -S scraper && adduser -S scraper -G scraper
|
|
RUN chown -R scraper:scraper /app
|
|
USER scraper
|
|
|
|
# ── Configuration ─────────────────────────────────────────────────────────────
|
|
ENV SCRAPER_WORKERS=0
|
|
ENV SCRAPER_STATIC_ROOT=/app/static/books
|
|
ENV SCRAPER_HTTP_ADDR=:8080
|
|
|
|
EXPOSE 8080
|
|
|
|
# Default: run as an HTTP server. Override CMD to use "run" for one-shot.
|
|
ENTRYPOINT ["/app/scraper"]
|
|
CMD ["serve"]
|