mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 07:59:11 +01:00
First-run flow: - /setup page + /api/setup: creates first user with hashed password (Node crypto scrypt, no new deps). POST rejects if users already exist. - Landing page redirects to /setup when DB has no users - middleware.ts: protects app routes, passes public pages through Auth: - passwordHash column added to users schema (drizzle-kit push applied) - src/lib/password.ts: hashPassword/verifyPassword via Node scrypt - auth.ts Credentials: env var takes priority, falls back to DB hash so packaged installs work without LOCAL_AUTH_PASSWORD Multi-tenancy groundwork: - Replaced DEFAULT_USER_ID with getCurrentUserId() across all 12 API route files (people, subscriptions, events, goals, projects, commitments) Docker: - Dockerfile: multi-stage Node 22 alpine, standalone output - docker-compose.yml: postgres + migrate + app services - .dockerignore, .env.example with documented required vars - next.config.ts: output: standalone - package.json: added migrate script (drizzle-kit push) - tsconfig.json: scope to src/ only, exclude .next generated files Install: clone → cp .env.example .env.local → docker-compose up First visit → /setup → create account → sign in → done. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
795 B
Docker
36 lines
795 B
Docker
FROM node:22-alpine AS base
|
|
WORKDIR /app
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
# Dependencies
|
|
FROM base AS deps
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Builder
|
|
FROM base AS builder
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN npx drizzle-kit generate 2>/dev/null || true
|
|
RUN npm run build
|
|
|
|
# Runner
|
|
FROM base AS runner
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
RUN addgroup --system --gid 1001 nodejs \
|
|
&& adduser --system --uid 1001 nextjs
|
|
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
COPY --from=builder /app/drizzle ./drizzle
|
|
|
|
USER nextjs
|
|
EXPOSE 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["node", "server.js"]
|