Spaces:
Sleeping
Sleeping
dOCKER
Browse files- Dockerfile +9 -6
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# Use the official Python image from the Docker
|
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 |
-
#
|
|
|
|
|
|
|
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
|