Update Dockerfile
Browse files- Dockerfile +10 -5
Dockerfile
CHANGED
@@ -12,15 +12,20 @@ WORKDIR /app
|
|
12 |
COPY requirements.txt .
|
13 |
|
14 |
# Install Python dependencies
|
15 |
-
RUN pip install --no-cache-dir
|
16 |
|
17 |
FROM python:3.9-slim
|
18 |
|
19 |
-
#
|
20 |
ENV TRANSFORMERS_CACHE=/app/cache
|
21 |
ENV PYTHONDONTWRITEBYTECODE=1
|
22 |
ENV PYTHONUNBUFFERED=1
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
# Create app directory and cache directory
|
25 |
RUN mkdir -p /app ${TRANSFORMERS_CACHE} && \
|
26 |
# Create a non-root user to run the application
|
@@ -29,9 +34,9 @@ RUN mkdir -p /app ${TRANSFORMERS_CACHE} && \
|
|
29 |
|
30 |
WORKDIR /app
|
31 |
|
32 |
-
# Copy
|
33 |
-
COPY
|
34 |
-
|
35 |
|
36 |
# Copy application code
|
37 |
COPY --chown=appuser:appuser . .
|
|
|
12 |
COPY requirements.txt .
|
13 |
|
14 |
# Install Python dependencies
|
15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
17 |
FROM python:3.9-slim
|
18 |
|
19 |
+
# Set environment variables
|
20 |
ENV TRANSFORMERS_CACHE=/app/cache
|
21 |
ENV PYTHONDONTWRITEBYTECODE=1
|
22 |
ENV PYTHONUNBUFFERED=1
|
23 |
|
24 |
+
# Install minimal dependencies for runtime
|
25 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
26 |
+
curl \
|
27 |
+
&& rm -rf /var/lib/apt/lists/*
|
28 |
+
|
29 |
# Create app directory and cache directory
|
30 |
RUN mkdir -p /app ${TRANSFORMERS_CACHE} && \
|
31 |
# Create a non-root user to run the application
|
|
|
34 |
|
35 |
WORKDIR /app
|
36 |
|
37 |
+
# Copy requirements and install directly in the final stage
|
38 |
+
COPY requirements.txt .
|
39 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
40 |
|
41 |
# Copy application code
|
42 |
COPY --chown=appuser:appuser . .
|