Update Dockerfile
Browse files- Dockerfile +7 -9
Dockerfile
CHANGED
|
@@ -1,29 +1,27 @@
|
|
| 1 |
-
# 2) Dockerfile (paste as a new file)
|
| 2 |
-
|
| 3 |
-
```dockerfile
|
| 4 |
FROM python:3.10-slim
|
| 5 |
|
| 6 |
-
#
|
| 7 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 8 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 9 |
PYTHONUNBUFFERED=1
|
| 10 |
|
| 11 |
-
# System
|
| 12 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
build-essential curl && \
|
| 14 |
rm -rf /var/lib/apt/lists/*
|
| 15 |
|
|
|
|
| 16 |
WORKDIR /code
|
| 17 |
|
| 18 |
-
# Install Python
|
| 19 |
COPY requirements.txt .
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
-
# Copy app
|
| 23 |
COPY . .
|
| 24 |
|
| 25 |
-
# Expose
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
-
# Start FastAPI with uvicorn
|
| 29 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Environment settings
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 5 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
PYTHONUNBUFFERED=1
|
| 7 |
|
| 8 |
+
# System dependencies
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
build-essential curl && \
|
| 11 |
rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Set work directory
|
| 14 |
WORKDIR /code
|
| 15 |
|
| 16 |
+
# Install Python dependencies
|
| 17 |
COPY requirements.txt .
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
+
# Copy the rest of the app
|
| 21 |
COPY . .
|
| 22 |
|
| 23 |
+
# Expose Hugging Face default port
|
| 24 |
EXPOSE 7860
|
| 25 |
|
| 26 |
+
# Start FastAPI app with uvicorn
|
| 27 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|