kivilaid commited on
Commit
80c7f39
·
verified ·
1 Parent(s): cc6b28d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -51
Dockerfile CHANGED
@@ -1,55 +1,56 @@
1
- ######################## build stage ########################
2
- FROM node:20-alpine AS build
3
- WORKDIR /src
4
 
5
  USER root
6
 
7
- # Arguments that can be passed at build time
8
- ARG FLOWISE_PATH=/usr/local/lib/node_modules/flowise
9
- ARG BASE_PATH=/data/.flowise
10
- ARG DATABASE_PATH=$BASE_PATH
11
- ARG APIKEY_PATH=$BASE_PATH
12
- ARG SECRETKEY_PATH=$BASE_PATH
13
- ARG LOG_PATH=$BASE_PATH/logs
14
-
15
- # Set the ARGs as ENV
16
- ENV FLOWISE_PATH=$FLOWISE_PATH
17
- ENV BASE_PATH=$BASE_PATH
18
- ENV DATABASE_PATH=$DATABASE_PATH
19
- ENV APIKEY_PATH=$APIKEY_PATH
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"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-alpine
 
 
2
 
3
  USER root
4
 
5
+ # Set environment variables
6
+ ENV PORT=8080
7
+ ENV HOST=0.0.0.0
8
+ ENV BASE_PATH=/data/.flowise
9
+ ENV DATABASE_PATH=/data/.flowise
10
+ ENV APIKEY_PATH=/data/.flowise
11
+ ENV SECRETKEY_PATH=/data/.flowise
12
+ ENV LOG_PATH=/data/.flowise/logs
13
+ ENV BLOB_STORAGE_PATH=/data/.flowise/storage
14
+ ENV EXECUTION_PATH=/app/packages/server/dist
15
+
16
+ # Install dependencies
17
+ RUN apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-dev chromium curl
18
+
19
+ # Set puppeteer environment variables
20
+ ENV PUPPETEER_SKIP_DOWNLOAD=true
21
+ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
22
+
23
+ # Set NODE_OPTIONS to increase memory limit
24
+ ENV NODE_OPTIONS=--max-old-space-size=4096
25
+
26
+ # Set working directory
 
 
 
 
 
 
 
 
 
 
27
  WORKDIR /app
28
+
29
+ # Copy all files
30
+ COPY . .
31
+
32
+ # Install pnpm
33
+ RUN npm install -g pnpm
34
+
35
+ # Install dependencies
36
+ RUN pnpm install
37
+
38
+ # Build project
39
+ RUN pnpm build
40
+
41
+ # Set server bin as executable
42
+ RUN chmod +x /app/packages/server/bin/run
43
+
44
+ # Create necessary directories
45
+ RUN mkdir -p /data/.flowise/logs /data/.flowise/storage
46
+ RUN chmod -R 777 /data/.flowise
47
+
48
+ # Expose port for Hugging Face
49
+ EXPOSE 8080
50
+
51
+ # Health check
52
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
53
+ CMD curl -f http://localhost:8080/ || exit 1
54
+
55
+ # Start command - using the native server bin script
56
+ CMD ["sh", "-c", "cd /app/packages/server/bin && ./run start"]