Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +23 -18
Dockerfile
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
|
| 4 |
-
ENV
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
FROM python:3.10-slim
|
| 12 |
-
|
| 13 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
| 14 |
-
ENV PYTHONUNBUFFERED=1
|
| 15 |
|
|
|
|
| 16 |
WORKDIR /app
|
| 17 |
|
| 18 |
-
|
| 19 |
-
COPY . /app
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
|
|
|
|
| 24 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
-
# Download
|
| 27 |
RUN python -m spacy download en_core_web_sm
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
EXPOSE 7860
|
| 30 |
|
|
|
|
| 31 |
CMD ["python", "app.py"]
|
| 32 |
-
|
|
|
|
| 1 |
+
# Use slim Python image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set environment variables for performance
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
+
PYTHONUNBUFFERED=1 \
|
| 7 |
+
OMP_NUM_THREADS=1 \
|
| 8 |
+
MKL_NUM_THREADS=1 \
|
| 9 |
+
OPENBLAS_NUM_THREADS=1 \
|
| 10 |
+
VECLIB_MAXIMUM_THREADS=1 \
|
| 11 |
+
NUMEXPR_NUM_THREADS=1
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
# Set working directory
|
| 14 |
WORKDIR /app
|
| 15 |
|
| 16 |
+
# Copy requirements and apt dependencies first
|
| 17 |
+
COPY requirements.txt apt.txt /app/
|
| 18 |
|
| 19 |
+
# Install system dependencies and clean up
|
| 20 |
+
RUN apt-get update && \
|
| 21 |
+
xargs -a apt.txt apt-get install -y && \
|
| 22 |
+
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 23 |
|
| 24 |
+
# Install Python dependencies
|
| 25 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
+
# Download spaCy model
|
| 28 |
RUN python -m spacy download en_core_web_sm
|
| 29 |
|
| 30 |
+
# Copy application files and models
|
| 31 |
+
COPY . /app/
|
| 32 |
+
|
| 33 |
+
# Expose Flask's default port
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
+
# Run the app
|
| 37 |
CMD ["python", "app.py"]
|
|
|