Spaces:
Runtime error
Runtime error
added git workflow to deploy backend, and docker for backend
Browse files- Dockerfile +18 -0
- main.py +0 -1
Dockerfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# Working dir inside the container.
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
|
| 6 |
+
# Copies req.txt from local machine into /app inside container.
|
| 7 |
+
COPY requirements.txt .
|
| 8 |
+
|
| 9 |
+
RUN pip install -r requirements.txt
|
| 10 |
+
|
| 11 |
+
# Copy the rest of files into /app folder.
|
| 12 |
+
COPY . .
|
| 13 |
+
|
| 14 |
+
# As HF want for backend.
|
| 15 |
+
EXPOSE 7860
|
| 16 |
+
|
| 17 |
+
# Starting the server. 0.0.0.0 accepts connections from anywhere, not just local.
|
| 18 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
main.py
CHANGED
|
@@ -11,7 +11,6 @@ from backend.api.routers import health
|
|
| 11 |
from contextlib import asynccontextmanager
|
| 12 |
from infra.logger_structlog import StructLogger
|
| 13 |
import asyncio
|
| 14 |
-
from huggingface_hub import hf_hub_download
|
| 15 |
|
| 16 |
@asynccontextmanager
|
| 17 |
async def lifespan(app: FastAPI):
|
|
|
|
| 11 |
from contextlib import asynccontextmanager
|
| 12 |
from infra.logger_structlog import StructLogger
|
| 13 |
import asyncio
|
|
|
|
| 14 |
|
| 15 |
@asynccontextmanager
|
| 16 |
async def lifespan(app: FastAPI):
|