feat: optimize Dockerfile for HuggingFace Spaces deployment
Browse files- Dockerfile +17 -3
Dockerfile
CHANGED
|
@@ -62,8 +62,15 @@ COPY api/ api/
|
|
| 62 |
|
| 63 |
WORKDIR /app/api
|
| 64 |
|
| 65 |
-
# Install
|
| 66 |
-
RUN pip install --no-cache-dir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
poetry config virtualenvs.create false && \
|
| 68 |
poetry install --no-dev --no-interaction --no-ansi
|
| 69 |
|
|
@@ -80,7 +87,14 @@ RUN useradd -m -u 1000 user && \
|
|
| 80 |
# Install runtime dependencies
|
| 81 |
RUN apt-get install -y --no-install-recommends \
|
| 82 |
nodejs npm libgmp-dev libmpfr-dev libmpc-dev && \
|
| 83 |
-
pip install --no-cache-dir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
python -m nltk.downloader punkt averaged_perceptron_tagger
|
| 85 |
|
| 86 |
# Set up directory structure
|
|
|
|
| 62 |
|
| 63 |
WORKDIR /app/api
|
| 64 |
|
| 65 |
+
# Install core dependencies first
|
| 66 |
+
RUN pip install --no-cache-dir \
|
| 67 |
+
poetry==1.8.3 \
|
| 68 |
+
gunicorn \
|
| 69 |
+
gevent \
|
| 70 |
+
grpcio \
|
| 71 |
+
pydantic-settings \
|
| 72 |
+
protobuf \
|
| 73 |
+
grpcio-tools && \
|
| 74 |
poetry config virtualenvs.create false && \
|
| 75 |
poetry install --no-dev --no-interaction --no-ansi
|
| 76 |
|
|
|
|
| 87 |
# Install runtime dependencies
|
| 88 |
RUN apt-get install -y --no-install-recommends \
|
| 89 |
nodejs npm libgmp-dev libmpfr-dev libmpc-dev && \
|
| 90 |
+
pip install --no-cache-dir \
|
| 91 |
+
gunicorn \
|
| 92 |
+
gevent \
|
| 93 |
+
grpcio \
|
| 94 |
+
pydantic-settings \
|
| 95 |
+
protobuf \
|
| 96 |
+
grpcio-tools \
|
| 97 |
+
nltk && \
|
| 98 |
python -m nltk.downloader punkt averaged_perceptron_tagger
|
| 99 |
|
| 100 |
# Set up directory structure
|