Adieee5 commited on
Commit
eb6ffad
·
verified ·
1 Parent(s): 192342d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -17
Dockerfile CHANGED
@@ -1,19 +1,6 @@
1
  FROM python:3.9
2
 
3
- # Create a non-root user
4
- RUN useradd -m -u 1000 user
5
- USER user
6
- ENV PATH="/home/user/.local/bin:$PATH"
7
-
8
- # Set working directory
9
- WORKDIR /app
10
-
11
- # Copy and install Python dependencies
12
- COPY --chown=user ./requirements.txt requirements.txt
13
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
-
15
- # Install system dependencies and build tools
16
- USER root
17
  RUN apt-get update && apt-get install -y \
18
  python3 \
19
  python3-pip \
@@ -33,13 +20,25 @@ RUN wget https://www.sqlite.org/2023/sqlite-autoconf-3410200.tar.gz \
33
  # Update library path to use the new SQLite
34
  ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
35
 
36
- RUN mkdir -p /app/static/chroma_store && chown -R user:user /app/static/chroma_store
37
- # Go back to non-root user and app directory
 
 
 
 
 
38
  USER user
 
 
 
39
  WORKDIR /app
40
 
 
 
 
 
41
  # Copy the app source code
42
  COPY --chown=user . /app
43
 
44
  # Start the app
45
- CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--preload"]
 
1
  FROM python:3.9
2
 
3
+ # Install system dependencies and build tools first
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  RUN apt-get update && apt-get install -y \
5
  python3 \
6
  python3-pip \
 
20
  # Update library path to use the new SQLite
21
  ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
22
 
23
+ # Create a non-root user
24
+ RUN useradd -m -u 1000 user
25
+
26
+ # Create necessary directories with proper permissions
27
+ RUN mkdir -p /app/chroma_store && chown -R user:user /app
28
+
29
+ # Switch to non-root user
30
  USER user
31
+ ENV PATH="/home/user/.local/bin:$PATH"
32
+
33
+ # Set working directory
34
  WORKDIR /app
35
 
36
+ # Copy and install Python dependencies
37
+ COPY --chown=user ./requirements.txt requirements.txt
38
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
39
+
40
  # Copy the app source code
41
  COPY --chown=user . /app
42
 
43
  # Start the app
44
+ CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--preload"]