Neurolingua commited on
Commit
0daaf05
1 Parent(s): eb2dd81

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -10
Dockerfile CHANGED
@@ -1,6 +1,7 @@
 
1
  FROM python:3.9-slim
2
 
3
- # Install necessary system dependencies and gnupg
4
  RUN apt-get update && apt-get install -y \
5
  libgl1-mesa-glx \
6
  libglib2.0-0 \
@@ -26,26 +27,26 @@ RUN apt-get update && apt-get install -y \
26
  # Set the working directory
27
  WORKDIR /code
28
 
29
- # Create necessary directories with appropriate permissions
30
  RUN mkdir -p /code/uploads /code/chroma_db
31
 
32
  # Add and use a non-root user
33
- RUN useradd -ms /bin/sh myuser \
34
- && chown -R myuser:myuser /code
35
 
36
- # Set directory permissions after ownership change
37
- RUN chmod -R 755 /code/chroma_db \
38
- && chmod -R 775 /code/uploads
 
39
 
40
  # Switch to non-root user
41
  USER myuser
42
 
43
  # Copy and install Python dependencies
44
- COPY ./requirements.txt /code/requirements.txt
45
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
46
 
47
  # Copy the application code
48
- COPY . /code
49
 
50
  # Default command to run the application
51
- CMD ["python", "app.py"]
 
1
+ # Use Python 3.9 slim image as the base
2
  FROM python:3.9-slim
3
 
4
+ # Install necessary system dependencies
5
  RUN apt-get update && apt-get install -y \
6
  libgl1-mesa-glx \
7
  libglib2.0-0 \
 
27
  # Set the working directory
28
  WORKDIR /code
29
 
30
+ # Create necessary directories
31
  RUN mkdir -p /code/uploads /code/chroma_db
32
 
33
  # Add and use a non-root user
34
+ RUN useradd -ms /bin/sh myuser
 
35
 
36
+ # Set ownership and permissions
37
+ RUN chown -R myuser:myuser /code && \
38
+ chmod -R 755 /code/chroma_db && \
39
+ chmod -R 775 /code/uploads
40
 
41
  # Switch to non-root user
42
  USER myuser
43
 
44
  # Copy and install Python dependencies
45
+ COPY --chown=myuser:myuser ./requirements.txt /code/requirements.txt
46
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
47
 
48
  # Copy the application code
49
+ COPY --chown=myuser:myuser . /code
50
 
51
  # Default command to run the application
52
+ CMD ["python", "app.py"]