feat: add Dockerfile and docker-compose for self-hosted deployment

This commit is contained in:
Bruno Deanoz 2026-05-19 08:28:52 +02:00
parent 0c09f3ff0c
commit 2f42c59599
4 changed files with 61 additions and 0 deletions

12
.dockerignore Normal file
View file

@ -0,0 +1,12 @@
.git
node_modules
.next
.noosphere-index
.env.local
.env*.local
*.log
.DS_Store
pdg
test-md.ts
tsconfig.tsbuildinfo
next-env.d.ts

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM node:22-alpine AS base
RUN corepack enable
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
FROM base AS runner
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build note index if content is available (skipped in CI, runs locally with content)
RUN [ -d content ] && node_modules/.bin/tsx scripts/build-index.ts || true
RUN node_modules/.bin/next build
RUN chmod +x docker-entrypoint.sh
ENV NODE_ENV=production
EXPOSE 3000
ENTRYPOINT ["./docker-entrypoint.sh"]

21
docker-compose.yml Normal file
View file

@ -0,0 +1,21 @@
services:
noz:
build: .
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ./content:/app/content
- ./noosphere.toml:/app/noosphere.toml:ro
- noz-index:/app/.noosphere-index
env_file:
- .env.local
noz-studio:
build: ../noz-studio
restart: unless-stopped
ports:
- "3001:3001"
volumes:
noz-index:

9
docker-entrypoint.sh Normal file
View file

@ -0,0 +1,9 @@
#!/bin/sh
set -e
if [ -d /app/content ]; then
echo "[noz] rebuilding note index…"
node_modules/.bin/tsx scripts/build-index.ts
fi
exec node_modules/.bin/next start