Bikas0 commited on
Commit
c32b3bf
·
verified ·
1 Parent(s): 0708784
Files changed (1) hide show
  1. Dockerfile +9 -6
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # Use the official Python image from the Docker Hubs
2
  FROM python:3.10.0-slim-buster
3
 
4
  # Set the working directory in the container
@@ -10,18 +10,21 @@ COPY . /app
10
  # Upgrade pip to the latest version
11
  RUN pip install --upgrade pip
12
 
13
- # Create directories for NLTK and Hugging Face cache data
 
 
 
14
  RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
15
 
 
 
 
16
  # Set environment variables
17
  ENV NLTK_DATA=/app/nltk_data
18
  ENV HF_HOME=/app/.huggingface_cache
19
 
20
- # Install any needed packages specified in requirements.txt
21
- RUN pip install --no-cache-dir -r requirements.txt
22
-
23
  # Change ownership of directories to the non-root user
24
- RUN chown -R nobody:nogroup /app
25
 
26
  # Switch to a non-root user
27
  USER nobody
 
1
+ # Use the official Python image from the Docker Hub
2
  FROM python:3.10.0-slim-buster
3
 
4
  # Set the working directory in the container
 
10
  # Upgrade pip to the latest version
11
  RUN pip install --upgrade pip
12
 
13
+ # Install any needed packages specified in requirements.txt
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+
16
+ # Create directories for NLTK and Hugging Face cache data with the root user
17
  RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
18
 
19
+ # Download NLTK data (punkt) with root permissions
20
+ RUN python -m nltk.downloader -d /app/nltk_data punkt
21
+
22
  # Set environment variables
23
  ENV NLTK_DATA=/app/nltk_data
24
  ENV HF_HOME=/app/.huggingface_cache
25
 
 
 
 
26
  # Change ownership of directories to the non-root user
27
+ RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache
28
 
29
  # Switch to a non-root user
30
  USER nobody