Spaces:
Runtime error
Runtime error
Oleg Lavrovsky
commited on
HF style Dockerfile
Browse files- Dockerfile +8 -9
- requirements.txt +2 -3
Dockerfile
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
# Use official lightweight Python image
|
| 2 |
FROM python:3-slim
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Install dependencies
|
| 8 |
-
COPY requirements.txt .
|
| 9 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
-
|
| 11 |
-
# Copy project files
|
| 12 |
-
COPY . .
|
| 13 |
-
|
| 14 |
-
# Expose port
|
| 15 |
-
EXPOSE 8000
|
| 16 |
|
| 17 |
# Run FastAPI app with Uvicorn
|
| 18 |
-
|
|
|
|
|
|
| 1 |
# Use official lightweight Python image
|
| 2 |
FROM python:3-slim
|
| 3 |
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
USER user
|
| 6 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
+
|
| 8 |
# Set working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
# Install dependencies
|
| 12 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Run FastAPI app with Uvicorn
|
| 16 |
+
COPY --chown=user . /app
|
| 17 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
requirements.txt
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
-
contextlib
|
| 2 |
fastapi
|
| 3 |
pydantic
|
| 4 |
torch
|
| 5 |
-
transformers
|
| 6 |
-
uvicorn
|
|
|
|
|
|
|
| 1 |
fastapi
|
| 2 |
pydantic
|
| 3 |
torch
|
| 4 |
+
transformers==4.56.0
|
| 5 |
+
uvicorn[standard]
|