Spaces:
Sleeping
Sleeping
update dockerfile
Browse files- Dockerfile +48 -0
Dockerfile
CHANGED
@@ -1,3 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Use the official Python image from the Docker Hub
|
2 |
FROM python:3.10.0-slim-buster
|
3 |
|
@@ -10,8 +49,16 @@ COPY . /app
|
|
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 |
RUN pip install --no-cache-dir numpy==1.21.0
|
16 |
|
17 |
# Create directories for NLTK and Hugging Face cache data
|
@@ -36,3 +83,4 @@ EXPOSE 7860
|
|
36 |
|
37 |
# Command to run the application
|
38 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|
|
|
|
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
|
5 |
+
# WORKDIR /app
|
6 |
+
|
7 |
+
# # Copy the current directory contents into the container at /app
|
8 |
+
# COPY . /app
|
9 |
+
|
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
|
17 |
+
# RUN mkdir -p /app/nltk_data /app/.cache/huggingface /app/.huggingface_cache
|
18 |
+
|
19 |
+
# # Download NLTK data (punkt and wordnet)
|
20 |
+
# RUN python -m nltk.downloader -d /app/nltk_data punkt wordnet
|
21 |
+
|
22 |
+
# # Set environment variables
|
23 |
+
# ENV NLTK_DATA=/app/nltk_data
|
24 |
+
# ENV HF_HOME=/app/.huggingface_cache
|
25 |
+
# ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
|
26 |
+
|
27 |
+
# # Change ownership of directories to the non-root user
|
28 |
+
# RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
|
29 |
+
|
30 |
+
# # Switch to a non-root user
|
31 |
+
# USER nobody
|
32 |
+
|
33 |
+
# # Make port 7860 available to the world outside this container
|
34 |
+
# EXPOSE 7860
|
35 |
+
|
36 |
+
# # Command to run the application
|
37 |
+
# CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|
38 |
+
|
39 |
+
|
40 |
# Use the official Python image from the Docker Hub
|
41 |
FROM python:3.10.0-slim-buster
|
42 |
|
|
|
49 |
# Upgrade pip to the latest version
|
50 |
RUN pip install --upgrade pip
|
51 |
|
52 |
+
# Install build essentials and gfortran
|
53 |
+
RUN apt-get update && apt-get install -y \
|
54 |
+
build-essential \
|
55 |
+
gfortran \
|
56 |
+
&& rm -rf /var/lib/apt/lists/*
|
57 |
+
|
58 |
# Install any needed packages specified in requirements.txt
|
59 |
RUN pip install --no-cache-dir -r requirements.txt
|
60 |
+
|
61 |
+
# Install NumPy version 1.21.0
|
62 |
RUN pip install --no-cache-dir numpy==1.21.0
|
63 |
|
64 |
# Create directories for NLTK and Hugging Face cache data
|
|
|
83 |
|
84 |
# Command to run the application
|
85 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|
86 |
+
|