Update Dockerfile
Browse files- Dockerfile +9 -16
Dockerfile
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
-
|
| 3 |
-
# Set environment variables
|
| 4 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
| 5 |
-
ENV PYTHONUNBUFFERED=1
|
| 6 |
-
|
| 7 |
-
# Install dependencies
|
| 8 |
-
RUN apt-get update && apt-get install -y git && apt-get clean
|
| 9 |
-
|
| 10 |
# Set working directory
|
| 11 |
-
WORKDIR /
|
| 12 |
-
|
| 13 |
-
# Copy files
|
| 14 |
COPY requirements.txt .
|
| 15 |
-
RUN pip install --
|
| 16 |
-
|
| 17 |
COPY main.py .
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
| 1 |
+
# Use an official Python base image
|
| 2 |
FROM python:3.10-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Set working directory
|
| 4 |
+
WORKDIR /code
|
| 5 |
+
# Install dependencies
|
|
|
|
| 6 |
COPY requirements.txt .
|
| 7 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 8 |
+
# Copy app files
|
| 9 |
COPY main.py .
|
| 10 |
+
# Expose port for Hugging Face Spaces
|
| 11 |
+
EXPOSE 7860
|
| 12 |
+
# Start the FastAPI app using uvicorn
|
| 13 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|