Update Dockerfile
Browse files- Dockerfile +25 -2
Dockerfile
CHANGED
|
@@ -1,13 +1,36 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
COPY package*.json ./
|
|
|
|
|
|
|
| 6 |
RUN npm ci
|
| 7 |
|
|
|
|
| 8 |
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
RUN npm run build
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
EXPOSE 7860
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
| 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 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 17 |
+
apt-get install -y nodejs
|
| 18 |
+
|
| 19 |
+
COPY package*.json ./
|
| 20 |
+
COPY src ./src
|
| 21 |
+
RUN npm install
|
| 22 |
+
RUN npm install reactflow
|
| 23 |
+
|
| 24 |
RUN npm run build
|
| 25 |
|
| 26 |
+
# Use the official Nginx image as the base for serving the built files
|
| 27 |
+
FROM nginx:stable-alpine
|
| 28 |
+
|
| 29 |
+
# Copy the built files from the previous stage to the Nginx HTML directory
|
| 30 |
+
COPY --from=0 /app/dist /usr/share/nginx/html
|
| 31 |
+
|
| 32 |
+
# Expose the default Nginx port
|
| 33 |
EXPOSE 7860
|
| 34 |
|
| 35 |
+
# Start Nginx when the container launches
|
| 36 |
+
CMD ["nginx", "-g", "daemon off;"]
|