celik-muhammed commited on
Commit
ada8864
·
verified ·
1 Parent(s): f2bcf68

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -11
Dockerfile CHANGED
@@ -5,9 +5,6 @@ FROM python:3.11-slim
5
  # Optional: Disable Usage Stats (telemetry) for Privacy / Stability
6
  ENV STREAMLIT_DISABLE_USAGE_STATS=true
7
 
8
- # Set working directory inside container
9
- WORKDIR /app
10
-
11
  # Install dependencies
12
  RUN apt-get update && apt-get install -y \
13
  build-essential \
@@ -26,18 +23,21 @@ RUN apt-get update && apt-get install -y \
26
  # Create a non-root user
27
  RUN useradd --create-home --shell /bin/bash appuser
28
 
29
- # Set permissions for the working directory
30
- RUN chown -R appuser:appuser /app
31
-
32
  # Switch to non-root user
33
  USER appuser
34
 
35
- # Copy source and requirements
36
- COPY requirements.txt ./
37
- COPY src/ ./src/
 
 
 
 
 
 
38
 
39
- # Install Python dependencies including streamlit
40
- RUN pip3 install --no-cache-dir --user -r requirements.txt
41
 
42
  # Expose port
43
  EXPOSE 8501
 
5
  # Optional: Disable Usage Stats (telemetry) for Privacy / Stability
6
  ENV STREAMLIT_DISABLE_USAGE_STATS=true
7
 
 
 
 
8
  # Install dependencies
9
  RUN apt-get update && apt-get install -y \
10
  build-essential \
 
23
  # Create a non-root user
24
  RUN useradd --create-home --shell /bin/bash appuser
25
 
 
 
 
26
  # Switch to non-root user
27
  USER appuser
28
 
29
+ # Set working directory inside container
30
+ WORKDIR /app
31
+
32
+ # Copy source and requirements (ownership already belongs to appuser)
33
+ COPY --chown=appuser:appuser requirements.txt ./
34
+ COPY --chown=appuser:appuser src/ ./src/
35
+
36
+ # Install Python dependencies
37
+ RUN pip install --no-cache-dir --user -r requirements.txt
38
 
39
+ # Update PATH to include user base binary directory
40
+ ENV PATH="/home/appuser/.local/bin:${PATH}"
41
 
42
  # Expose port
43
  EXPOSE 8501