ruv commited on
Commit
193757d
·
verified ·
1 Parent(s): 3d36762

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -23
Dockerfile CHANGED
@@ -1,37 +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 curl
11
- RUN apt-get update && apt-get install -y curl
12
 
13
- # Install Node.js 18.x
14
- RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
15
- apt-get install -y nodejs
16
-
17
- COPY package*.json ./
18
- COPY src ./src
19
- RUN npm install
20
- RUN npm install reactflow
21
-
22
- # Copy the rest of the application code to the working directory
23
  COPY . .
24
 
25
- # Build the React app
26
  RUN npm run build
27
 
28
- # Set the user to a non-root user for better security
29
- RUN useradd -m -u 1000 user
30
- USER user
31
- ENV HOME=/home/user
 
32
 
33
- # Expose the port that the app will run on (use port 7860 for Hugging Face Spaces)
34
  EXPOSE 7860
35
 
36
- # Specify the command to run the app
37
- CMD ["npm", "start"]
 
1
+ # Use the official Node.js image as the base
2
+ FROM node:18
3
 
4
+ # Set the working directory inside 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 the dependencies
11
+ RUN npm ci
12
 
13
+ # Copy the entire project to the working directory
 
 
 
 
 
 
 
 
 
14
  COPY . .
15
 
16
+ # Build the React application
17
  RUN npm run build
18
 
19
+ # Use the official Nginx image as the base for serving the built files
20
+ FROM nginx:stable-alpine
21
+
22
+ # Copy the built files from the previous stage to the Nginx HTML directory
23
+ COPY --from=0 /app/dist /usr/share/nginx/html
24
 
25
+ # Expose the default Nginx port
26
  EXPOSE 7860
27
 
28
+ # Start Nginx when the container launches
29
+ CMD ["nginx", "-g", "daemon off;"]