Spaces:
Runtime error
Runtime error
chironjit45
commited on
Commit
·
e816289
1
Parent(s):
cc7efce
all modified
Browse files- Dockerfile +20 -5
- requirements.txt +4 -4
Dockerfile
CHANGED
|
@@ -1,12 +1,27 @@
|
|
| 1 |
-
FROM python:3.9
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
RUN useradd -m -u 1000 user
|
| 4 |
USER user
|
| 5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
-
COPY --chown=user ./requirements.txt requirements.txt
|
| 9 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
| 2 |
|
| 3 |
+
# Install system dependencies
|
| 4 |
+
RUN apt-get update && \
|
| 5 |
+
apt-get install -y build-essential libffi-dev git && \
|
| 6 |
+
rm -rf /var/lib/apt/lists/*
|
| 7 |
+
|
| 8 |
+
# Create non-root user
|
| 9 |
RUN useradd -m -u 1000 user
|
| 10 |
USER user
|
| 11 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 12 |
|
| 13 |
WORKDIR /app
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# Copy requirements and install
|
| 16 |
+
COPY --chown=user requirements.txt requirements.txt
|
| 17 |
+
RUN python -m pip install --upgrade pip
|
| 18 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copy app and model
|
| 21 |
+
COPY --chown=user . /app
|
| 22 |
+
|
| 23 |
+
# Expose port
|
| 24 |
+
EXPOSE 7860
|
| 25 |
+
|
| 26 |
+
# Run FastAPI app
|
| 27 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
requirements.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
fastapi
|
| 2 |
-
uvicorn
|
| 3 |
-
numpy
|
| 4 |
-
pillow
|
| 5 |
torch
|
| 6 |
-
|
|
|
|
| 7 |
gradio
|
|
|
|
|
|
| 1 |
fastapi
|
| 2 |
+
uvicorn
|
|
|
|
|
|
|
| 3 |
torch
|
| 4 |
+
transformers
|
| 5 |
+
pytorch-lightning
|
| 6 |
gradio
|
| 7 |
+
sentencepiece
|