Update Dockerfile
Browse files- Dockerfile +12 -5
Dockerfile
CHANGED
|
@@ -15,14 +15,21 @@ ENV TRANSFORMERS_CACHE="/app/.cache/huggingface"
|
|
| 15 |
# Ensure cache directories exist and have correct permissions
|
| 16 |
RUN mkdir -p $HF_HOME $XDG_CACHE_HOME $PIP_CACHE_DIR $TRANSFORMERS_CACHE && chmod -R 777 /app/.cache
|
| 17 |
|
| 18 |
-
# Copy
|
| 19 |
-
COPY .
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
RUN pip install --no-cache-dir --
|
|
|
|
| 23 |
|
| 24 |
# Install SpaCy model explicitly under /app to avoid permission issues
|
| 25 |
-
RUN python -m spacy download en_core_web_sm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Run the Flask app
|
| 28 |
CMD ["python", "app.py"]
|
|
|
|
| 15 |
# Ensure cache directories exist and have correct permissions
|
| 16 |
RUN mkdir -p $HF_HOME $XDG_CACHE_HOME $PIP_CACHE_DIR $TRANSFORMERS_CACHE && chmod -R 777 /app/.cache
|
| 17 |
|
| 18 |
+
# Copy requirements first to leverage Docker cache
|
| 19 |
+
COPY requirements.txt .
|
| 20 |
|
| 21 |
+
# Upgrade pip and install dependencies globally (without --user)
|
| 22 |
+
RUN pip install --no-cache-dir --upgrade pip \
|
| 23 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
# Install SpaCy model explicitly under /app to avoid permission issues
|
| 26 |
+
RUN python -m spacy download en_core_web_sm
|
| 27 |
+
|
| 28 |
+
# Copy project files
|
| 29 |
+
COPY . .
|
| 30 |
+
|
| 31 |
+
# Ensure Flask is installed
|
| 32 |
+
RUN python -m pip show flask
|
| 33 |
|
| 34 |
# Run the Flask app
|
| 35 |
CMD ["python", "app.py"]
|