Update Dockerfile
Browse files- Dockerfile +16 -14
Dockerfile
CHANGED
|
@@ -1,37 +1,39 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
libopenblas-dev \
|
| 11 |
libomp-dev \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
# Create writable
|
| 15 |
-
RUN mkdir -p /tmp/huggingface_cache /tmp/matplotlib
|
|
|
|
| 16 |
|
| 17 |
-
# Set environment variables
|
| 18 |
-
ENV HF_HOME=/tmp
|
| 19 |
-
ENV
|
|
|
|
| 20 |
|
| 21 |
-
# Copy requirements
|
| 22 |
COPY requirements.txt /app/requirements.txt
|
| 23 |
|
| 24 |
# Install dependencies
|
| 25 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
-
# Install PyTorch separately
|
| 28 |
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
| 29 |
|
| 30 |
-
# Copy
|
| 31 |
COPY . /app
|
| 32 |
|
| 33 |
-
# Expose
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
-
# Run the
|
| 37 |
CMD ["python", "main.py"]
|
|
|
|
| 1 |
+
# Use Python 3.10 for compatibility
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
libopenblas-dev \
|
| 11 |
libomp-dev \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Create writable directories
|
| 15 |
+
RUN mkdir -p /tmp/huggingface_cache /tmp/matplotlib \
|
| 16 |
+
&& chmod -R 777 /tmp/huggingface_cache /tmp/matplotlib
|
| 17 |
|
| 18 |
+
# Set cache environment variables
|
| 19 |
+
ENV HF_HOME=/tmp
|
| 20 |
+
ENV TRANSFORMERS_CACHE=/tmp
|
| 21 |
+
ENV MPLCONFIGDIR=/tmp
|
| 22 |
|
| 23 |
+
# Copy requirements file
|
| 24 |
COPY requirements.txt /app/requirements.txt
|
| 25 |
|
| 26 |
# Install dependencies
|
| 27 |
+
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
| 28 |
|
| 29 |
+
# Install PyTorch separately for compatibility
|
| 30 |
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
| 31 |
|
| 32 |
+
# Copy application files
|
| 33 |
COPY . /app
|
| 34 |
|
| 35 |
+
# Expose Flask app port
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
+
# Run the application
|
| 39 |
CMD ["python", "main.py"]
|