Update Dockerfile
Browse files- Dockerfile +6 -27
Dockerfile
CHANGED
@@ -1,36 +1,15 @@
|
|
1 |
-
# Build stage
|
2 |
-
FROM python:3.10 AS builder
|
3 |
-
WORKDIR /app
|
4 |
-
|
5 |
-
# Set up cache directories
|
6 |
-
RUN mkdir -p /tmp/huggingface_cache && chmod 777 /tmp/huggingface_cache
|
7 |
-
ENV HF_HOME=/tmp/huggingface_cache
|
8 |
-
ENV TRANSFORMERS_CACHE=/tmp/huggingface_cache
|
9 |
-
|
10 |
-
# Copy requirements and install
|
11 |
-
COPY requirements.txt .
|
12 |
-
RUN pip install -r requirements.txt
|
13 |
-
|
14 |
-
# Pre-download models
|
15 |
-
COPY download_models.py .
|
16 |
-
RUN python download_models.py
|
17 |
-
|
18 |
-
# Runtime stage
|
19 |
FROM python:3.10-slim
|
20 |
-
WORKDIR /app
|
21 |
|
22 |
-
|
23 |
-
RUN mkdir -p /tmp/huggingface_cache && chmod 777 /tmp/huggingface_cache
|
24 |
-
ENV HF_HOME=/tmp/huggingface_cache
|
25 |
-
ENV TRANSFORMERS_CACHE=/tmp/huggingface_cache
|
26 |
|
27 |
-
#
|
28 |
-
|
29 |
-
COPY
|
30 |
-
|
31 |
|
32 |
# Copy application code
|
33 |
COPY . .
|
34 |
|
35 |
EXPOSE 50010
|
|
|
36 |
CMD ["python3", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
FROM python:3.10-slim
|
|
|
2 |
|
3 |
+
WORKDIR /app
|
|
|
|
|
|
|
4 |
|
5 |
+
# Install build dependencies (if any are needed by pip packages)
|
6 |
+
# Remove build dependencies afterward if minimizing size is critical
|
7 |
+
COPY requirements.txt .
|
8 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
9 |
|
10 |
# Copy application code
|
11 |
COPY . .
|
12 |
|
13 |
EXPOSE 50010
|
14 |
+
|
15 |
CMD ["python3", "app.py"]
|