File size: 813 Bytes
3f7575f
 
 
a5871f0
 
 
3f7575f
 
1eb1e17
 
 
 
 
 
 
 
 
 
 
 
 
3f7575f
 
 
 
1eb1e17
a5871f0
3f7575f
 
 
 
 
 
 
a5871f0
3f7575f
 
 
a5871f0
3f7575f
a5871f0
 
3f7575f
 
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
# Use official Node.js image as base
ARG BASE=node:20-slim
FROM ${BASE} AS base

WORKDIR /app

# Copy dependency files
COPY package.json package-lock.json ./
# Copy the rest of the source code
COPY . .
# Install system dependencies for canvas
RUN apt-get update && apt-get install -y \
    python3 \
    make \
    g++ \
    libcairo2-dev \
    libjpeg-dev \
    libpango1.0-dev \
    libgif-dev \
    librsvg2-dev \
    && rm -rf /var/lib/apt/lists/*

# Install pnpm and dependencies
RUN npm install -g pnpm && pnpm install



# Build Next.js app
RUN pnpm run build

# Production image
FROM base AS production

WORKDIR /app

# Set environment variables for Hugging Face Spaces
ENV PORT=7860 \
    NODE_ENV=production

# Expose the port your app runs on
EXPOSE 7860

# Start the Next.js app
CMD ["pnpm", "start"]