radames commited on
Commit
35a76b0
1 Parent(s): 651d960

add steps make it compatible with persistent storage

Browse files

in case users enable persist storage on HF Spaces, `/data` is not mounted at buildtime, only at runtime.
this enables preparing the /logpath at runtime

Files changed (1) hide show
  1. Dockerfile +12 -4
Dockerfile CHANGED
@@ -3,12 +3,20 @@ USER root
3
 
4
  # Arguments that can be passed at build time
5
  ARG FLOWISE_PATH=/usr/local/lib/node_modules/flowise
6
- ARG BASE_PATH=/root/.flowise
7
  ARG DATABASE_PATH=$BASE_PATH
8
  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
 
@@ -18,9 +26,9 @@ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
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"]
 
3
 
4
  # Arguments that can be passed at build time
5
  ARG FLOWISE_PATH=/usr/local/lib/node_modules/flowise
6
+ ARG BASE_PATH=/data/.flowise
7
  ARG DATABASE_PATH=$BASE_PATH
8
  ARG APIKEY_PATH=$BASE_PATH
9
  ARG SECRETKEY_PATH=$BASE_PATH
10
  ARG LOG_PATH=$BASE_PATH/logs
11
 
12
+ # Set the ARGs as ENV
13
+ ENV FLOWISE_PATH=$FLOWISE_PATH
14
+ ENV BASE_PATH=$BASE_PATH
15
+ ENV DATABASE_PATH=$DATABASE_PATH
16
+ ENV APIKEY_PATH=$APIKEY_PATH
17
+ ENV SECRETKEY_PATH=$SECRETKEY_PATH
18
+ ENV LOG_PATH=$LOG_PATH
19
+
20
  # Install dependencies
21
  RUN apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-dev chromium
22
 
 
26
  # Install Flowise globally
27
  RUN npm install -g flowise
28
 
29
+ # # Configure Flowise directories using the ARG
30
+ RUN mkdir -p $FLOWISE_PATH/uploads /data && chmod -R 777 $FLOWISE_PATH /data
31
 
32
  WORKDIR /data
33
 
34
+ CMD ["sh", "-c", "mkdir -p $LOG_PATH && chmod -R 777 $LOG_PATH && npx flowise start"]