HenryHeng commited on
Commit
3681061
1 Parent(s): 651d960

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -6
Dockerfile CHANGED
@@ -1,4 +1,6 @@
1
- FROM node:18-alpine
 
 
2
  USER root
3
 
4
  # Arguments that can be passed at build time
@@ -9,18 +11,26 @@ ARG APIKEY_PATH=$BASE_PATH
9
  ARG SECRETKEY_PATH=$BASE_PATH
10
  ARG LOG_PATH=$BASE_PATH/logs
11
 
12
- # Install dependencies
13
- RUN apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-dev chromium
14
-
15
  ENV PUPPETEER_SKIP_DOWNLOAD=true
16
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
17
 
18
  # Install Flowise globally
19
  RUN npm install -g flowise
20
 
 
 
 
 
 
 
 
 
 
21
  # Configure Flowise directories using the ARG
22
  RUN mkdir -p $LOG_PATH $FLOWISE_PATH/uploads && chmod -R 777 $LOG_PATH $FLOWISE_PATH
23
 
24
- WORKDIR /data
 
 
25
 
26
- CMD ["npx", "flowise", "start"]
 
1
+ # Stage 1: Build stage
2
+ FROM node:20-alpine as build
3
+
4
  USER root
5
 
6
  # Arguments that can be passed at build time
 
11
  ARG SECRETKEY_PATH=$BASE_PATH
12
  ARG LOG_PATH=$BASE_PATH/logs
13
 
 
 
 
14
  ENV PUPPETEER_SKIP_DOWNLOAD=true
15
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
16
 
17
  # Install Flowise globally
18
  RUN npm install -g flowise
19
 
20
+ # Stage 2: Runtime stage
21
+ FROM node:20-alpine
22
+
23
+ # Install runtime dependencies
24
+ RUN apk add --no-cache chromium git python3 py3-pip make g++ build-base cairo-dev pango-dev
25
+
26
+ # Set the environment variable for Puppeteer to find Chromium
27
+ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
28
+
29
  # Configure Flowise directories using the ARG
30
  RUN mkdir -p $LOG_PATH $FLOWISE_PATH/uploads && chmod -R 777 $LOG_PATH $FLOWISE_PATH
31
 
32
+ # Copy Flowise from the build stage
33
+ COPY --from=build /usr/local/lib/node_modules /usr/local/lib/node_modules
34
+ COPY --from=build /usr/local/bin /usr/local/bin
35
 
36
+ ENTRYPOINT ["flowise", "start"]