Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -12
Dockerfile
CHANGED
|
@@ -1,23 +1,27 @@
|
|
| 1 |
# Use an official lightweight Python image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
# Copy the rest of your application code
|
| 14 |
-
COPY . .
|
| 15 |
|
| 16 |
-
#
|
| 17 |
EXPOSE 7860
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
# Command to run your attendance system
|
| 23 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
# Use an official lightweight Python image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# Create a non-root user (Required by Hugging Face Spaces)
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
|
| 8 |
+
# Set environment variables
|
| 9 |
+
ENV HOME=/home/user \
|
| 10 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 11 |
+
PYTHONUNBUFFERED=1
|
| 12 |
|
| 13 |
+
# Set the working directory
|
| 14 |
+
WORKDIR $HOME/app
|
| 15 |
+
|
| 16 |
+
# Copy requirements and install them
|
| 17 |
+
COPY --chown=user requirements.txt .
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
# Copy the rest of your application code
|
| 21 |
+
COPY --chown=user . .
|
| 22 |
|
| 23 |
+
# Hugging Face routes traffic to port 7860
|
| 24 |
EXPOSE 7860
|
| 25 |
|
| 26 |
+
# Run the application using Gunicorn
|
| 27 |
+
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
|
|
|
|
|
|
|
|
|