File size: 1,441 Bytes
457930f
f42efe4
457930f
f42efe4
457930f
 
 
 
 
f42efe4
457930f
 
309e72d
 
 
 
 
 
457930f
309e72d
 
 
f42efe4
309e72d
 
 
 
 
 
f42efe4
 
309e72d
f42efe4
 
309e72d
 
f42efe4
309e72d
 
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
# syntax=docker.io/docker/dockerfile:1

FROM node:18-alpine AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
# Copy necessary files from the builder stage
# Copy production dependencies
COPY --from=builder /app/node_modules ./node_modules
# Copy the build output (.next folder)
COPY --from=builder /app/.next ./.next
# Copy public assets
COPY --from=builder /app/public ./public
# Copy next.config.js if it exists
COPY --from=builder /app/next.config.js ./next.config.js


# Set the environment variable for the Next.js port (default is 3000)
# Hugging Face Spaces typically exposes port 7860 for Gradio/Streamlit/etc,
# but for general web apps (like Next.js via the static host option or if you set up a custom server),
# it might expose port 3000 by default when detecting a standard Next.js app.
# It's good practice to set this, but Spaces often handles port mapping.
ENV PORT 3000


# Expose the port the application will run on
EXPOSE 3000

# Disable Next.js telemetry at runtime
ENV NEXT_TELEMETRY_DISABLED 1

# Command to run the production Next.js server
CMD ["npm", "start"]