# syntax=docker/dockerfile:1.7 # # The SQLite engine ships inside the Deno binary itself (node:sqlite) — no # native libraries to install, so the slim alpine image works fine. FROM denoland/deno:alpine-2.9.1 AS base WORKDIR /app # Cache dependencies in a separate layer so rebuilds skip the network fetch # when only main.ts changes. COPY deno.json deno.lock* ./ COPY main.ts ./ RUN deno cache main.ts # Single mounted volume holds both the SQLite DB and blobs. main.ts creates # subdirectories on startup; declaring the volume documents the contract and # gives a sane default if the user forgets to mount one. ENV DATA_DIR=/data RUN mkdir -p /data VOLUME ["/data"] ENV PORT=8080 EXPOSE 8080 # Deno-based healthcheck — avoids depending on wget/curl being present. HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ CMD ["deno", "eval", "const r = await fetch(`http://127.0.0.1:${Deno.env.get('PORT') ?? '8080'}/api/v1/doc`); if (!r.ok) Deno.exit(1)"] # --unstable-cron registers the scheduled jobs (auth pruning, blob GC, # metering) via Deno.cron; without it the server runs but skips them. CMD ["deno", "run", "-A", "--unstable-cron", "main.ts"]