Create Dockerfile
Browse files- Dockerfile +28 -0
Dockerfile
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use official Python slim image for a leaner base
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
# Set working directory
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy requirements file first to leverage Docker cache
|
8 |
+
COPY requirements.txt .
|
9 |
+
|
10 |
+
# Install system dependencies and Python packages
|
11 |
+
RUN apt-get update && apt-get install -y \
|
12 |
+
gcc \
|
13 |
+
&& rm -rf /var/lib/apt/lists/* \
|
14 |
+
&& pip install --no-cache-dir pip-tools \
|
15 |
+
&& pip-sync requirements.txt \
|
16 |
+
&& pip install --no-cache-dir gradio
|
17 |
+
|
18 |
+
# Copy the rest of the application code
|
19 |
+
COPY . .
|
20 |
+
|
21 |
+
# Expose Gradio default port
|
22 |
+
EXPOSE 7860
|
23 |
+
|
24 |
+
# Set environment variable to prevent Python buffering
|
25 |
+
ENV PYTHONUNBUFFERED=1
|
26 |
+
|
27 |
+
# Run the Gradio app
|
28 |
+
CMD ["python", "app.py"]
|