Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +24 -0
Dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as the base image
|
| 2 |
+
FROM python:3.9
|
| 3 |
+
|
| 4 |
+
# Create a user to avoid permission issues (required for Hugging Face Spaces)
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
|
| 7 |
+
# Set the working directory
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
# Copy and install requirements
|
| 11 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 12 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 13 |
+
|
| 14 |
+
# Copy the rest of the application
|
| 15 |
+
COPY --chown=user . /app
|
| 16 |
+
|
| 17 |
+
# Initialize the database
|
| 18 |
+
RUN python init_db.py
|
| 19 |
+
|
| 20 |
+
# Expose the port (Hugging Face default is 7860)
|
| 21 |
+
EXPOSE 7860
|
| 22 |
+
|
| 23 |
+
# Run the Flask app
|
| 24 |
+
CMD ["python", "app.py"]
|