/svc/examples lists FILIUS' examples, which lie beside F in the image (GPL like this repository, kept out of the dashboard); /svc/projects makes a project from one; /svc/projects/<id>/import takes a .fls (up to 64 MiB), /copy copies a project as it is now, /export gives it back as a .fls with its warnings. Large files go into the blob store on import and come back from it on export, which is refused when one is missing. Found on the way: Node's request body is a Buffer, and Yjs takes no Buffer into a document, so every .fls with binary files would have failed; and fflate, now in the bundle, imports createRequire itself, which the build's banner declared again, so F did not start. The banner names it otherwise and a test builds and starts the bundle. The proxy's /svc/ takes 70 MB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
2.1 KiB
Docker
46 lines
2.1 KiB
Docker
# Server F as an image: the Filius service and the editor's page in one.
|
|
#
|
|
# Built from the repository's root (the build needs every package and the
|
|
# corpus, whose FILIUS examples the editor carries):
|
|
#
|
|
# docker compose -f deploy/docker-compose.yml --env-file deploy/test.env build
|
|
#
|
|
# Two stages. The first installs everything and builds: esbuild bundles the
|
|
# service into main.mjs and its room thread into simWorker.mjs, with every
|
|
# dependency inside; Vite builds the editor; precompressMain.mjs lays a .br
|
|
# and a .gz beside its files. The second stage takes only these files, so
|
|
# the image holds no node_modules, no sources and no compiler.
|
|
#
|
|
# Node 24 (active LTS), not the 20 of the development machines: 20 has had
|
|
# no security fixes since April 2026, and a service facing the browsers of a
|
|
# whole school should not run on it. The bundles are built for node20 and
|
|
# run unchanged on 24; the image's run is checked before each release (see
|
|
# the README).
|
|
|
|
FROM node:24-alpine AS build
|
|
WORKDIR /src
|
|
COPY . .
|
|
RUN npm ci --no-audit --no-fund
|
|
RUN npm run build -w @mdg-filius/server \
|
|
&& npm run build -w @mdg-filius/editor \
|
|
&& node packages/server/dist/precompressMain.mjs packages/editor/dist
|
|
|
|
FROM node:24-alpine
|
|
LABEL org.opencontainers.image.title="mdg-filius" \
|
|
org.opencontainers.image.description="Filius network simulation, shared editing (server F)" \
|
|
org.opencontainers.image.licenses="GPL-3.0-only"
|
|
ENV NODE_ENV=production
|
|
WORKDIR /app
|
|
COPY --from=build /src/packages/server/dist/main.mjs /src/packages/server/dist/simWorker.mjs ./
|
|
COPY --from=build /src/packages/editor/dist ./editor
|
|
# FILIUS' examples, from which the dashboard makes projects (/svc/examples).
|
|
COPY corpus/java-examples ./examples
|
|
COPY LICENSE README.md CHANGES.md ./
|
|
# Not root: F needs no privilege, and a hole in it should not get one.
|
|
USER node
|
|
EXPOSE 8080
|
|
# The proxy keeps no watch of its own; this one shows in `docker compose ps`.
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
|
CMD wget -q -O /dev/null http://127.0.0.1:8080/healthz || exit 1
|
|
CMD ["node", "main.mjs"]
|