kivilaid commited on
Commit
cc6b28d
·
verified ·
1 Parent(s): 8a7ee58

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -15
Dockerfile CHANGED
@@ -1,4 +1,6 @@
1
- FROM node:20-alpine
 
 
2
 
3
  USER root
4
 
@@ -18,22 +20,36 @@ ENV APIKEY_PATH=$APIKEY_PATH
18
  ENV SECRETKEY_PATH=$SECRETKEY_PATH
19
  ENV LOG_PATH=$LOG_PATH
20
 
21
- # Install dependencies
22
  RUN apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-dev chromium
23
 
24
- ENV PUPPETEER_SKIP_DOWNLOAD=true
25
- ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
26
-
27
- # Install Flowise globally
28
- # RUN npm install -g flowise
29
-
30
- RUN npm install -g "git+https://github.com/kivilaid/Flowise.git" && ln -s $FLOWISE_PATH/packages/server/bin/run /usr/local/bin/flowise && chmod +x $FLOWISE_PATH/packages/server/bin/run
31
 
32
- # # Configure Flowise directories using the ARG
33
- RUN mkdir -p $FLOWISE_PATH/uploads && chmod -R 777 $FLOWISE_PATH
34
-
35
- #CMD ["sh", "-c", "mkdir -p $LOG_PATH && chmod -R 777 $LOG_PATH && npx flowise start"]
36
-
37
- CMD ["sh", "-c", "mkdir -p $LOG_PATH && chmod -R 777 $LOG_PATH && flowise start"]
38
 
 
 
 
 
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ######################## build stage ########################
2
+ FROM node:20-alpine AS build
3
+ WORKDIR /src
4
 
5
  USER root
6
 
 
20
  ENV SECRETKEY_PATH=$SECRETKEY_PATH
21
  ENV LOG_PATH=$LOG_PATH
22
 
23
+ # system deps (chromium is needed for screenshot / browser nodes)
24
  RUN apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-dev chromium
25
 
26
+ ENV PUPPETEER_SKIP_DOWNLOAD=true \
27
+ PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
 
 
 
 
 
28
 
29
+ # 1. clone your fork change the URL and branch if needed
30
+ RUN git clone --depth 1 https://github.com/kivilaid/Flowise.git .
 
 
 
 
31
 
32
+ # 2. install & build with pnpm (exactly like upstream)
33
+ RUN corepack enable && corepack prepare pnpm@9 --activate
34
+ RUN pnpm install --frozen-lockfile
35
+ RUN pnpm build # creates dist/ ready to run
36
 
37
+ ######################## runtime stage ########################
38
+ FROM node:20-alpine
39
+ WORKDIR /app
40
+ RUN apk add --no-cache chromium
41
+
42
+ # persistent volume Hugging Face mounts at /data
43
+ ENV BASE_PATH=/data/.flowise \
44
+ LOG_PATH=/data/.flowise/logs \
45
+ PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
46
+ PORT=7860
47
+
48
+ # copy only what the server needs → final image ≈ 180 MB
49
+ COPY --from=build /src/dist ./dist
50
+ COPY --from=build /src/node_modules ./node_modules
51
+ COPY --from=build /src/packages/ui ./packages/ui
52
+ COPY --from=build /src/packages/server/config ./packages/server/config
53
+
54
+ # make sure the log dir exists on first start
55
+ CMD ["sh", "-c", "mkdir -p $LOG_PATH && node dist/index.js"]