rajsecrets0 commited on
Commit
c129701
·
verified ·
1 Parent(s): 8c6af9b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -15
Dockerfile CHANGED
@@ -1,28 +1,27 @@
1
  FROM python:3.9-slim
2
 
3
- WORKDIR /app
 
4
 
5
- # Copy all files
6
- COPY . /app
7
 
8
- # Install system dependencies
9
- RUN apt-get update && apt-get install -y \
10
- tesseract-ocr \
11
- libtesseract-dev \
12
- && rm -rf /var/lib/apt/lists/*
13
 
14
- # Install Python dependencies
 
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
- # Set permissions for /app directory
18
- RUN mkdir -p /app/.files && chown -R 1000:1000 /app
19
 
20
- # Create a non-root user
21
- RUN useradd -u 1000 -m myuser
22
- USER myuser
23
 
24
  # Expose port 7860
25
  EXPOSE 7860
26
 
27
  # Run the app
28
- CMD ["chainlit", "run", "app.py", "--port", "7860"]
 
1
  FROM python:3.9-slim
2
 
3
+ # Create a non-root user
4
+ RUN useradd -m -u 1000 user
5
 
6
+ # Set the working directory
7
+ WORKDIR /home/user/app
8
 
9
+ # Set environment variables
10
+ ENV HOME=/home/user
11
+ ENV PATH=/home/user/.local/bin:$PATH
 
 
12
 
13
+ # Copy requirements.txt and install dependencies
14
+ COPY --chown=user:user requirements.txt /home/user/app/requirements.txt
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Copy the rest of the application code
18
+ COPY --chown=user:user . /home/user/app
19
 
20
+ # Switch to the non-root user
21
+ USER user
 
22
 
23
  # Expose port 7860
24
  EXPOSE 7860
25
 
26
  # Run the app
27
+ CMD ["chainlit", "run", "app.py", "--port", "7860"]