Spaces:
Running
Running
File size: 1,128 Bytes
3fc514e 7a6e1d4 5c08455 af97408 3e644a4 7a6e1d4 5c08455 7a6e1d4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | FROM node:20-bookworm-slim AS base
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --maxsockets 5 --network-timeout 120000
# The lockfile is generated on Windows, so install the Linux GNU native bindings
# Tailwind and Lightning CSS need inside the Debian-based HF build image.
RUN npm install --no-save @tailwindcss/oxide-linux-x64-gnu@4.1.13 lightningcss-linux-x64-gnu@1.30.1
# Build the application
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN npm run build
# Production image
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=7860
ENV HOSTNAME="0.0.0.0"
RUN addgroup --system --gid 1001 nodejs
RUN 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
USER nextjs
EXPOSE 7860
CMD ["node", "server.js"]
|