Update Dockerfile
Browse files- Dockerfile +17 -10
Dockerfile
CHANGED
@@ -1,16 +1,23 @@
|
|
1 |
-
#
|
2 |
-
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
8 |
-
ENV PATH
|
9 |
-
|
10 |
-
WORKDIR /app
|
11 |
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
CMD ["
|
|
|
1 |
+
# Use the official Python slim image for a smaller footprint
|
2 |
+
FROM python:3.11-slim
|
3 |
|
4 |
+
# Set working directory
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy requirements and install dependencies
|
8 |
+
COPY requirements.txt .
|
9 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
10 |
+
|
11 |
+
# Copy the Flask app code
|
12 |
+
COPY . .
|
13 |
|
14 |
+
# Create a non-root user for security (Hugging Face requirement)
|
15 |
RUN useradd -m -u 1000 user
|
16 |
USER user
|
17 |
+
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
|
|
|
|
|
18 |
|
19 |
+
# Expose port 7860 (required by Hugging Face)
|
20 |
+
EXPOSE 7860
|
21 |
|
22 |
+
# Run the Flask app with Gunicorn
|
23 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|