Spaces:
Running
Running
fullstuckdev
commited on
Commit
•
c01243f
1
Parent(s):
52f7c56
dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:18-slim
|
2 |
+
|
3 |
+
# Install required system dependencies
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
build-essential \
|
6 |
+
&& rm -rf /var/lib/apt/lists/*
|
7 |
+
|
8 |
+
# Change node user ID to match host user ID
|
9 |
+
RUN usermod -u 1000 node
|
10 |
+
|
11 |
+
ARG HF_TOKEN
|
12 |
+
ENV API_TOKEN=$HF_TOKEN
|
13 |
+
|
14 |
+
# Set working directory and ownership
|
15 |
+
WORKDIR /app
|
16 |
+
RUN chown -R node:node /app
|
17 |
+
|
18 |
+
# Switch to node user
|
19 |
+
USER node
|
20 |
+
|
21 |
+
# Copy package files
|
22 |
+
COPY --chown=node:node package*.json ./
|
23 |
+
|
24 |
+
# Install dependencies
|
25 |
+
RUN npm install
|
26 |
+
|
27 |
+
# Copy the rest of the application
|
28 |
+
COPY --chown=node:node . .
|
29 |
+
|
30 |
+
# Build the Next.js application
|
31 |
+
RUN npm run build
|
32 |
+
|
33 |
+
EXPOSE 3000
|
34 |
+
|
35 |
+
CMD ["npm", "start"]
|