SPB Git

Repository Public

Dockerfile 3.0 KB 68 lines docker

1# syntax=docker/dockerfile:12#3# Sheet — one image for the web process, the worker and the backup job.4#5# NOT BUILT, NOT RUN by the author of this file: it was written from package.json, scripts/ and src/worker/export.ts.6# Read infra/README.md before relying on it.7#8# Build context = the project root (see docker-compose.yml):9#   docker build -f infra/Dockerfile -t sheet-app .10# The ignore list for that context is infra/Dockerfile.dockerignore (BuildKit reads <Dockerfile>.dockerignore).1112ARG NODE_VERSION=2613FROM node:${NODE_VERSION}-bookworm-slim1415ENV NEXT_TELEMETRY_DISABLED=1 \16    PLAYWRIGHT_BROWSERS_PATH=/ms-playwright1718# Tools used by scripts/backup.sh and scripts/restore.sh: pg_dump / pg_restore 17 (PGDG repository, because Debian19# bookworm ships client 15, which cannot dump a version 17 server), openssl, tar, bash, find.20RUN apt-get update \21 && apt-get install -y --no-install-recommends ca-certificates curl openssl tar bash findutils \22 && install -d /usr/share/postgresql-common/pgdg \23 && curl -fsSL -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc \24 && echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list \25 && apt-get update \26 && apt-get install -y --no-install-recommends postgresql-client-17 \27 && rm -rf /var/lib/apt/lists/*2829# The project is developed with pnpm 11 (pnpm-workspace.yaml also carries the pnpm 12 allow-list).30RUN npm install -g pnpm@113132WORKDIR /app3334# Dependencies first, for layer caching. Development dependencies are needed by `next build`; tsx is a runtime dependency.35COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./36RUN pnpm install --frozen-lockfile3738# Chromium for PDF / PNG exports, with its system libraries (this step runs as root). The browser lands in39# PLAYWRIGHT_BROWSERS_PATH, where the worker finds it without CHROMIUM_PATH; at start-up the worker launches it once40# to check that it really works (src/worker/export.ts).41RUN node_modules/.bin/playwright-core install --with-deps chromium-headless-shell \42 && rm -rf /var/lib/apt/lists/*4344COPY . .4546# DATABASE_URL only has to be present for modules imported during the build; no connection is opened.47# APP_URL is read at run time (robots.txt, feeds and metadata are rendered per request).48RUN DATABASE_URL="postgres://build:build@127.0.0.1:5432/build" \49    NODE_ENV=production \50    node_modules/.bin/next build5152# Data directories (mounted as volumes by docker-compose.yml) and an unprivileged user.53RUN mkdir -p /data/storage /data/backups /data/setup \54 && chown -R node:node /data /app/.next55USER node5657ENV NODE_ENV=production \58    HOST=0.0.0.0 \59    PORT=8700 \60    STORAGE_ROOT=/data/storage \61    BACKUP_DIR=/data/backups \62    SETUP_URL_FILE=/data/setup/setup-url.txt6364EXPOSE 87006566# Default: the web process. The worker and the backup job override the command (docker-compose.yml).67CMD ["node_modules/.bin/tsx", "server.ts"]68
Files main
Menu

Theme