Files
logbuch/Dockerfile
T
Matthias G 7a594eeacf Fix container build for sharp, slug lookup and select fields
- build the runtime image so libvips lands next to the sharp binary
- GET /api/v1/posts/:slug finds drafts by slug for write clients
- media upload documented with project slug instead of a project id
- own select control instead of the browser default
- quieter sidebar footer, project name leads to its entries
2026-08-01 11:48:48 +02:00

47 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1
FROM node:24-alpine AS base
RUN corepack enable && corepack prepare pnpm@latest --activate
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN pnpm build
FROM base AS sharp
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
RUN mkdir -p /out && cp -RL node_modules/.pnpm/@img+* /out/
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
RUN --mount=from=sharp,source=/out,target=/tmp/img \
rm -rf node_modules/.pnpm/@img+* \
&& cp -R /tmp/img/. node_modules/.pnpm/ \
&& chown -R nextjs:nodejs node_modules/.pnpm
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/drizzle ./drizzle
COPY --from=builder --chown=nextjs:nodejs /app/docs/style-guide.md ./docs/style-guide.md
COPY --from=builder --chown=nextjs:nodejs /app/scripts/migrate.mjs ./scripts/migrate.mjs
COPY --chown=nextjs:nodejs entrypoint.sh ./entrypoint.sh
RUN chmod +x entrypoint.sh
RUN mkdir -p storage && chown -R nextjs:nodejs storage
USER nextjs
EXPOSE 4700
ENV PORT=4700
ENV HOSTNAME="0.0.0.0"
ENV STORAGE_DIR=/app/storage
CMD ["./entrypoint.sh"]