mirror of
https://github.com/Tony0410/nextstep.git
synced 2026-05-24 13:21:39 +08:00
- Fix argon2 native module build in Docker (add build-essential, python3) - Switch Docker base image from Alpine to Debian-slim for OpenSSL compatibility - Fix session cookies for HTTP access (COOKIE_SECURE env var) - Fix TypeScript type errors in sync routes and middleware - Fix CSS circular dependency in globals.css - Fix Map iteration in rate-limit cleanup - Add createdAt field to LocalNote interface - Configure Tailscale Funnel on port 10000 - Update NEXT_PUBLIC_APP_URL for public funnel access - Add initial Prisma migration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
65 lines
1.8 KiB
Docker
65 lines
1.8 KiB
Docker
# Stage 1: Dependencies
|
|
FROM node:20-slim AS deps
|
|
RUN apt-get update && apt-get install -y openssl build-essential python3 && rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json* ./
|
|
COPY prisma ./prisma/
|
|
|
|
RUN npm ci
|
|
|
|
# Stage 2: Builder
|
|
FROM node:20-slim AS builder
|
|
RUN apt-get update && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
# Generate Prisma client
|
|
RUN npx prisma generate
|
|
|
|
# Build the application
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV NODE_ENV=production
|
|
|
|
RUN npm run build
|
|
|
|
# Stage 3: Runner (using slim Debian for better OpenSSL compatibility)
|
|
FROM node:20-slim AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV TZ=Australia/Perth
|
|
|
|
RUN addgroup --system --gid 1001 nodejs
|
|
RUN adduser --system --uid 1001 nextjs
|
|
|
|
# Install OpenSSL and CA certificates for Prisma
|
|
RUN apt-get update && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/prisma ./prisma
|
|
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
|
COPY --from=builder /app/node_modules/argon2 ./node_modules/argon2
|
|
COPY --from=builder /app/node_modules/node-gyp-build ./node_modules/node-gyp-build
|
|
|
|
# Set the correct permission for prerender cache
|
|
RUN mkdir .next
|
|
RUN chown nextjs:nodejs .next
|
|
|
|
# Automatically leverage output traces to reduce image size
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
# Start the app (run migrations separately with: docker exec nextstep-app npx prisma migrate deploy)
|
|
CMD ["node", "server.js"]
|