Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +15 -23
Dockerfile
CHANGED
|
@@ -1,37 +1,29 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM node:
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy package.json and package-lock.json to the working directory
|
| 8 |
COPY package*.json ./
|
| 9 |
|
| 10 |
-
# Install
|
| 11 |
-
RUN
|
| 12 |
|
| 13 |
-
#
|
| 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
|
| 26 |
RUN npm run build
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
| 32 |
|
| 33 |
-
# Expose the
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
CMD ["
|
|
|
|
| 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;"]
|