Files
splatoon3.ink/workers/compressor/Dockerfile
Matt Isenhower c053372361 Compress archive days in a Cloudflare Container
A separate compressor Worker runs app/data/ArchiveCompressor.mjs in a container (standard-1)
once a day at 00:30 UTC, against the archive Space. Its Durable Object starts the container
and keeps the last 30 runs with their log lines. An alarm every few seconds collects the
container's output from its log server and ends the run when the container reports its exit
code, so a run survives the object being evicted from memory.

Only dev is deployed; production waits until spectre stops compressing at the same time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 13:11:24 -08:00

25 lines
959 B
Docker

# The archive compressor's container. Built with the repository root as its context (see
# image_build_context in wrangler.jsonc); Dockerfile.dockerignore keeps that context small.
FROM node:24-slim
# tar is in the base image; zstd does the compression (app/data/TarZstdWriter.mjs).
RUN apt-get update \
&& apt-get install -y --no-install-recommends zstd \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# The same locked dependencies as the rest of the backend. Install scripts are skipped: the
# compressor only needs the S3 client and Sentry, not sharp's native setup.
COPY package.json package-lock.json ./
RUN npm ci --omit=dev --ignore-scripts && npm cache clean --force
COPY app ./app
COPY workers/compressor/container ./workers/compressor/container
USER node
ENV NODE_ENV=production
# Where the container serves its log lines to the Durable Object (container/logServer.mjs).
EXPOSE 8080
CMD ["node", "workers/compressor/container/compress.mjs"]