ayush2917 commited on
Commit
3c3d26a
·
verified ·
1 Parent(s): 4f86dd4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -6
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # Use a slim Python 3.9 base image
2
- FROM python:3.9-slim-buster
3
 
4
  # Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE=1 \
@@ -28,18 +28,17 @@ COPY requirements.txt .
28
  RUN pip install --no-cache-dir -r requirements.txt || { echo "Failed to install requirements"; exit 1; }
29
 
30
  # Pre-download the SentenceTransformer model
31
- RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" || { echo "Failed to pre-download model"; exit 1; }
32
 
33
- # Create necessary directories
34
  RUN mkdir -p /app/data /app/cache && \
 
35
  chown -R myuser:myuser /app
36
 
37
  # Copy all project files
38
  COPY . .
39
 
40
- # Create non-root user and set permissions
41
- RUN useradd -m myuser && \
42
- chown -R myuser:myuser /app
43
  USER myuser
44
 
45
  # Expose port for Gunicorn
 
1
  # Use a slim Python 3.9 base image
2
+ FROM python:3.9-slim-buster@sha256:320a7a4250aba4249f458872adecf92eea88dc6abd2d76dc5c0f01cac9b53990
3
 
4
  # Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE=1 \
 
28
  RUN pip install --no-cache-dir -r requirements.txt || { echo "Failed to install requirements"; exit 1; }
29
 
30
  # Pre-download the SentenceTransformer model
31
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2', cache_folder='/app/cache')" || { echo "Failed to pre-download model"; exit 1; }
32
 
33
+ # Create directories, user, and set permissions
34
  RUN mkdir -p /app/data /app/cache && \
35
+ useradd -m myuser && \
36
  chown -R myuser:myuser /app
37
 
38
  # Copy all project files
39
  COPY . .
40
 
41
+ # Set non-root user
 
 
42
  USER myuser
43
 
44
  # Expose port for Gunicorn