Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +32 -0
Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.9 as base image
|
| 2 |
+
FROM python:3.9
|
| 3 |
+
|
| 4 |
+
# Disable GPU usage for TensorFlow
|
| 5 |
+
ENV CUDA_VISIBLE_DEVICES="-1"
|
| 6 |
+
|
| 7 |
+
# Install system dependencies for OpenCV and font issues
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
libgl1-mesa-glx \
|
| 10 |
+
libglib2.0-0 \
|
| 11 |
+
fonts-dejavu \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
+
|
| 14 |
+
# Set working directory
|
| 15 |
+
WORKDIR /app
|
| 16 |
+
|
| 17 |
+
# Copy and install dependencies
|
| 18 |
+
COPY requirements.txt .
|
| 19 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 20 |
+
pip install --no-cache-dir -r requirements.txt
|
| 21 |
+
|
| 22 |
+
# Copy project files
|
| 23 |
+
COPY . .
|
| 24 |
+
|
| 25 |
+
# Ensure the static/uploads directory exists and is writable
|
| 26 |
+
RUN mkdir -p static/uploads && chmod -R 777 static
|
| 27 |
+
|
| 28 |
+
# Expose the port
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Start the Flask app
|
| 32 |
+
CMD ["python", "app.py"]
|