HenryHeng Amansoni7477030 commited on
Commit
2377d1a
1 Parent(s): 8fb59d0

Upload Dockerfile (#5)

Browse files

- Upload Dockerfile (5c4d9ab6708e7e3183b250494624d3213b6775db)


Co-authored-by: Aman Soni <[email protected]>

Files changed (1) hide show
  1. Dockerfile +39 -33
Dockerfile CHANGED
@@ -1,34 +1,40 @@
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
7
- ARG FLOWISE_PATH=/usr/local/lib/node_modules/flowise
8
- ARG BASE_PATH=/root/.flowise
9
- ARG DATABASE_PATH=$BASE_PATH
10
- ARG APIKEY_PATH=$BASE_PATH
11
- ARG SECRETKEY_PATH=$BASE_PATH
12
- ARG LOG_PATH=$BASE_PATH/logs
13
- ARG BLOB_STORAGE_PATH=$BASE_PATH/storage
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
- # Stage 2: Runtime stage
22
  FROM node:20-alpine
23
-
24
- # Install runtime dependencies
25
- RUN apk add --no-cache chromium git python3 py3-pip make g++ build-base cairo-dev pango-dev
26
-
27
- # Configure Flowise directories using the ARG
28
- RUN mkdir -p $LOG_PATH $BLOB_STORAGE_PATH $FLOWISE_PATH/uploads && chmod -R 777 $LOG_PATH $BLOB_STORAGE_PATH $FLOWISE_PATH
29
-
30
- # Copy Flowise from the build stage
31
- COPY --from=build /usr/local/lib/node_modules /usr/local/lib/node_modules
32
- COPY --from=build /usr/local/bin /usr/local/bin
33
-
34
- ENTRYPOINT ["flowise", "start"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Node.js 20 Alpine as base image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  FROM node:20-alpine
3
+ # Install PNPM globally, create directories, and install dependencies
4
+ RUN npm i -g pnpm && \
5
+ # Create the /data directory with appropriate permissions
6
+ mkdir -p /data && chmod -R 777 /data && \
7
+ # Create the flowise directory with appropriate permissions
8
+ mkdir -p /usr/local/lib/node_modules/flowise && chmod -R 777 /usr/local/lib/node_modules/flowise && \
9
+ # Install dependencies
10
+ apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-dev chromium
11
+ # Switch to a non-root user for security
12
+ USER node
13
+ # Arguments that can be passed at build time and set them as environment variables
14
+ ARG FLOWISE_PATH=/usr/local/lib/node_modules/flowise
15
+ ARG BASE_PATH=/data/.flowise
16
+ ENV FLOWISE_PATH=$FLOWISE_PATH \
17
+ BASE_PATH=$BASE_PATH \
18
+ DATABASE_PATH=$BASE_PATH \
19
+ APIKEY_PATH=$BASE_PATH \
20
+ SECRETKEY_PATH=$BASE_PATH \
21
+ LOG_PATH=$BASE_PATH/logs \
22
+ PUPPETEER_SKIP_DOWNLOAD=true \
23
+ PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
24
+ # Create the /app directory with appropriate permissions, set working directory
25
+ RUN mkdir -p /home/node/app && chmod -R 777 /home/node/app
26
+ WORKDIR /home/node/app
27
+
28
+ RUN \
29
+ # Clone the Flowise repository from GitHub
30
+ git clone https://github.com/FlowiseAI/Flowise.git . && \
31
+ # Install Flowise dependencies
32
+ pnpm install && \
33
+ # Build Flowise
34
+ pnpm build
35
+ # Set permissions and create directories
36
+ RUN sh -c 'mkdir -p $LOG_PATH && chmod -R 777 $LOG_PATH && \
37
+ mkdir -p $FLOWISE_PATH/uploads && chmod -R 777 $FLOWISE_PATH/uploads'
38
+
39
+ # Set the entry point to run Flowise
40
+ CMD pnpm start