5ab2acc711
- Fix Authentik button type casting issue in login page * Use exported signIn instead of authClient type assertion * Add proper error handling for OAuth calls - Fix image MIME type handling in import-photo.ts * Convert base64 to data URL format for AI SDK compatibility - Fix type annotations in auth/server.ts changeEmail handler * Add explicit type annotation for destructured parameters These TypeScript errors were preventing 'pnpm build' from completing during Docker image build process.
70 lines
1.9 KiB
Docker
70 lines
1.9 KiB
Docker
# Multi-stage build for Next.js monorepo
|
|
FROM node:22-alpine AS base
|
|
RUN corepack enable pnpm
|
|
WORKDIR /app
|
|
|
|
# Install dependencies stage
|
|
FROM base AS deps
|
|
RUN apk add --no-cache libc6-compat git python3 make g++
|
|
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|
RUN pnpm install --frozen-lockfile --prod
|
|
|
|
# Build stage
|
|
FROM base AS builder
|
|
RUN apk add --no-cache libc6-compat git postgresql-client python3 make g++
|
|
|
|
# Accept build arguments for Next.js environment
|
|
ARG NEXT_PUBLIC_VAPID_PUBLIC_KEY=dummy_key_for_build
|
|
ARG BETTER_AUTH_SECRET=dummy_secret_for_build
|
|
ARG BETTER_AUTH_URL=http://localhost:3000
|
|
|
|
# Set environment variables for build
|
|
ENV NEXT_PUBLIC_VAPID_PUBLIC_KEY=${NEXT_PUBLIC_VAPID_PUBLIC_KEY}
|
|
ENV BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
|
ENV BETTER_AUTH_URL=${BETTER_AUTH_URL}
|
|
ENV CI=true
|
|
|
|
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|
RUN echo "Installing dependencies..." && pnpm install --frozen-lockfile
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the app with verbose output
|
|
RUN echo "Building application..." && pnpm build || (echo "Build failed, showing logs..." && cat /tmp/pnpm-*.log 2>/dev/null || true && exit 1)
|
|
|
|
# Production runtime
|
|
FROM base AS runtime
|
|
RUN apk add --no-cache libc6-compat postgresql-client
|
|
ENV NODE_ENV production
|
|
|
|
# Copy production node_modules
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
# Copy built Next.js app
|
|
COPY --from=builder /app/apps/web/.next/standalone ./
|
|
|
|
# Copy public assets
|
|
COPY --from=builder /app/apps/web/public ./public
|
|
|
|
# Copy workspace packages (needed for migrations)
|
|
COPY --from=builder /app/packages ./packages
|
|
|
|
# Copy root package.json for pnpm monorepo
|
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
|
|
|
|
# Copy entrypoint script
|
|
COPY docker/entrypoint.sh /app/entrypoint.sh
|
|
RUN chmod +x /app/entrypoint.sh
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
ENV PORT 3000
|
|
|
|
CMD ["/app/entrypoint.sh"]
|