GabrielLogspace commited on
Commit
b37b58e
1 Parent(s): 6f3e851

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -10
Dockerfile CHANGED
@@ -1,29 +1,32 @@
1
  FROM nikolaik/python-nodejs:python3.10-nodejs21
2
 
3
  # Update and install required packages
4
- RUN apt-get update && apt-get install gcc g++ git make pipx -y
5
 
6
  ENV LANGFLOW_HOME=/home/langflow \
7
  PATH=/root/.local/bin:$PATH
8
  ENV LANGFLOW_DATABASE_URL=sqlite:////home/langflow/langflow.db
9
 
10
- # Clone the langflow repository and switch to the dev branch
11
  ADD https://api.github.com/repos/logspace-ai/langflow/git/refs/heads/db version.json
12
  RUN git clone https://github.com/logspace-ai/langflow.git $LANGFLOW_HOME \
13
  && cd $LANGFLOW_HOME \
14
  && git checkout zustand/io/migration && git pull
15
 
16
- # Copy the code into the container
17
- WORKDIR $LANGFLOW_HOME
18
- COPY --chown=user:user . .
 
19
 
20
- # Create logs directory and set permissions
21
- RUN mkdir logs && chmod 777 logs
 
22
 
23
- # Set permissions for database folder
24
- RUN chmod 777 /home/langflow
25
 
26
  # Update the config.yaml file, build and install the langflow package
 
27
  RUN make setup_poetry && make install_frontend && make build_frontend && make install_backend
28
 
29
- CMD ["make", "start", "host=0.0.0.0", "port=7860", "log_level=debug", "open_browser=false"]
 
1
  FROM nikolaik/python-nodejs:python3.10-nodejs21
2
 
3
  # Update and install required packages
4
+ RUN apt-get update && apt-get install -y gcc g++ git make pipx && rm -rf /var/lib/apt/lists/*
5
 
6
  ENV LANGFLOW_HOME=/home/langflow \
7
  PATH=/root/.local/bin:$PATH
8
  ENV LANGFLOW_DATABASE_URL=sqlite:////home/langflow/langflow.db
9
 
10
+ # Clone the langflow repository and switch to the relevant branch
11
  ADD https://api.github.com/repos/logspace-ai/langflow/git/refs/heads/db version.json
12
  RUN git clone https://github.com/logspace-ai/langflow.git $LANGFLOW_HOME \
13
  && cd $LANGFLOW_HOME \
14
  && git checkout zustand/io/migration && git pull
15
 
16
+ # Create a non-root user 'langflow' and grant ownership
17
+ RUN adduser --disabled-password --gecos '' langflow && chown -R langflow:langflow $LANGFLOW_HOME
18
+
19
+ USER langflow
20
 
21
+ # Copy the code into the container, now as the non-root user
22
+ WORKDIR $LANGFLOW_HOME
23
+ COPY --chown=langflow:langflow . .
24
 
25
+ # Create logs directory (as 'langflow' user)
26
+ RUN mkdir logs
27
 
28
  # Update the config.yaml file, build and install the langflow package
29
+ # Make sure the non-root user has permissions to execute these operations
30
  RUN make setup_poetry && make install_frontend && make build_frontend && make install_backend
31
 
32
+ CMD ["make", "start", "host=0.0.0.0", "port=7860", "log_level=debug", "open_browser=false"]