Something went wrong. Try again.
Synapse is a study workspace. Organize courses read and annotate the material, train with generated exercises and watch your progress forked from denishovart.com/synapse
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556# Synapse server: one image that serves the API and the built web app.## docker build -t synapse .# docker build --target plus -t synapse:plus .# docker run -p 3000:3000 -v synapse-data:/app/apps/api/data \# -v synapse-uploads:/app/apps/api/uploads synapse## Migrations run automatically at boot. Seed demo courses once with:# docker exec <container> node dist/scripts/seed.js## The default image converts nothing beyond PDF, keeping it small. The `plus`# target adds the conversion tools (LibreOffice for office formats, pandoc# with weasyprint for markup formats) for uploads beyond PDF.
FROM node:22-bookworm-slim AS buildRUN apt-get update \ && apt-get install -y --no-install-recommends python3 build-essential ca-certificates \ && rm -rf /var/lib/apt/lists/*RUN corepack enableWORKDIR /appCOPY . .# The workspace allowBuilds list (pnpm-workspace.yaml) approves the native# build scripts (better-sqlite3, bcrypt, esbuild, swc, nest).RUN pnpm install --frozen-lockfileRUN pnpm build# A self-contained production bundle of the API (its dist, its prod deps,# the workspace packages it uses), without any dev dependency.RUN pnpm --filter @synapse/api deploy --prod --legacy /deploy/api
FROM node:22-bookworm-slim AS runtimeENV NODE_ENV=production# In a container the loopback-only default would make the service# unreachable; publish the port deliberately and front it with TLS.ENV HOST=0.0.0.0ENV PORT=3000COPY --from=build /deploy/api /app/apps/apiCOPY --from=build /app/apps/web/dist /app/apps/web/distWORKDIR /app/apps/apiRUN mkdir -p data uploads && chown -R node:node /app/apps/api/data /app/apps/api/uploadsUSER nodeEXPOSE 3000VOLUME ["/app/apps/api/data", "/app/apps/api/uploads"]CMD ["node", "dist/main.js"]
FROM runtime AS plusUSER rootRUN apt-get update \ && apt-get install -y --no-install-recommends \ pandoc weasyprint fonts-liberation \ libreoffice-writer libreoffice-impress libreoffice-calc \ && rm -rf /var/lib/apt/lists/*USER node
# Last stage, so a bare `docker build` produces the small image.FROM runtime