Spaces:
Build error
Build error
Create Dockerfile
Browse files- Dockerfile +29 -0
Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Node.js runtime as the base image
|
| 2 |
+
FROM node:16-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy package.json and package-lock.json to the working directory
|
| 8 |
+
COPY package*.json ./
|
| 9 |
+
|
| 10 |
+
# Install dependencies, including React Flow
|
| 11 |
+
RUN npm ci
|
| 12 |
+
RUN npm install reactflow
|
| 13 |
+
|
| 14 |
+
# Copy the rest of the application code to the working directory
|
| 15 |
+
COPY . .
|
| 16 |
+
|
| 17 |
+
# Build the React app
|
| 18 |
+
RUN npm run build
|
| 19 |
+
|
| 20 |
+
# Set the user to a non-root user for better security
|
| 21 |
+
RUN useradd -m -u 1000 user
|
| 22 |
+
USER user
|
| 23 |
+
ENV HOME=/home/user
|
| 24 |
+
|
| 25 |
+
# Expose the port that the app will run on (use port 7860 for Hugging Face Spaces)
|
| 26 |
+
EXPOSE 7860
|
| 27 |
+
|
| 28 |
+
# Specify the command to run the app
|
| 29 |
+
CMD ["npm", "start"]
|