File size: 804 Bytes
c4db85d
 
 
c7bfb1a
b90ef8e
c7bfb1a
 
c4db85d
 
c7bfb1a
b90ef8e
c7bfb1a
 
b90ef8e
c7bfb1a
 
b90ef8e
c4db85d
 
 
 
 
b90ef8e
c4db85d
 
 
 
 
 
 
13d16e3
 
 
c4db85d
 
 
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
# Use an official Node runtime as a parent image
FROM node:22-alpine

# Hugging Face Spaces require running as a non-root user (UID 1000)
# The official 'node' image already provides a user named 'node' with UID 1000

# Set the working directory
WORKDIR /app

# Give the non-root user ownership of the working directory
RUN chown -R node:node /app

# Switch to the non-root user
USER node

# Copy package.json and permissions
COPY --chown=node:node package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY --chown=node:node . .

# Build the frontend and backend 
RUN npm run build

# Set environment to production
ENV NODE_ENV=production

# Hugging Face default port is 7860
ENV PORT=7860
EXPOSE 7860 1935

# Start the production server
CMD ["npm", "start"]