58 lines
1.6 KiB
Docker
58 lines
1.6 KiB
Docker
# Multi-stage Dockerfile for Immich Redaktionsportal
|
|
# Node.js 24 Alpine standalone build
|
|
|
|
FROM node:24-alpine AS base
|
|
RUN corepack enable && corepack prepare pnpm@10.34.5 --activate
|
|
|
|
FROM base AS dependencies
|
|
WORKDIR /app
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY --from=dependencies /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
# Set build-time dummy env vars required for static layout evaluation during next build
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV DATABASE_URL=postgres://portal:portal@localhost:5432/portal
|
|
ENV BETTER_AUTH_SECRET=00000000000000000000000000000000
|
|
ENV BETTER_AUTH_URL=http://localhost:3000
|
|
ENV IMMICH_BASE_URL=http://localhost:2283
|
|
ENV IMMICH_API_KEY=build-time-dummy-key
|
|
ENV SMTP_HOST=localhost
|
|
ENV SMTP_PORT=587
|
|
ENV SMTP_USER=portal@localhost
|
|
ENV SMTP_PASSWORD=dummy-password
|
|
ENV SMTP_FROM=portal@localhost
|
|
ENV LEGAL_IMPRINT_URL=https://example.com/impressum
|
|
ENV LEGAL_PRIVACY_URL=https://example.com/datenschutz
|
|
ENV LEGAL_TERMS_URL=https://example.com/nutzungsbedingungen
|
|
|
|
RUN pnpm build
|
|
|
|
FROM node:24-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
adduser --system --uid 1001 nextjs
|
|
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/drizzle ./drizzle
|
|
COPY --from=builder /app/drizzle.config.ts ./drizzle.config.ts
|
|
COPY --from=builder /app/scripts ./scripts
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "server.js"]
|