FROM node:20-alpine # 1. Set environment variables for Hugging Face and Puppeteer ENV PORT=7860 ENV PUPPETEER_SKIP_DOWNLOAD=true ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser # 2. Define standard Flowise paths # Using /data as the base path allows for easy persistent storage mapping in Hugging Face ENV FLOWISE_PATH=/usr/local/lib/node_modules/flowise ENV BASE_PATH=/data ENV DATABASE_PATH=$BASE_PATH ENV SECRETKEY_PATH=$BASE_PATH ENV LOG_PATH=$BASE_PATH/logs ENV BLOB_STORAGE_PATH=$BASE_PATH/storage USER root # 3. Install necessary system dependencies RUN apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-dev chromium # 4. Install Flowise globally RUN npm install -g flowise # 5. Create directories and set permissions # 777 permissions are often necessary in containerized cloud environments to prevent read/write errors RUN mkdir -p $LOG_PATH $FLOWISE_PATH/uploads $BASE_PATH && \ chmod -R 777 $LOG_PATH $FLOWISE_PATH $BASE_PATH # 6. Set working directory and expose the required port WORKDIR /data EXPOSE 7860 # 7. Start the application CMD ["npx", "flowise", "start"]