Spaces:
Paused
Paused
Update Dockerfile
#6
by
InnoLink - opened
- Dockerfile +25 -9
Dockerfile
CHANGED
|
@@ -30,22 +30,38 @@ FROM python:3.11-slim
|
|
| 30 |
|
| 31 |
# The two following lines are requirements for the Dev Mode to be functional
|
| 32 |
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
|
| 33 |
-
RUN useradd -m -u 1000 user
|
| 34 |
WORKDIR /app
|
| 35 |
|
| 36 |
-
COPY
|
|
|
|
| 37 |
#RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 38 |
|
| 39 |
# Install uv for faster dependency resolution, then install packages system-wide
|
| 40 |
-
RUN pip install --upgrade pip && \
|
| 41 |
pip install --no-cache-dir uv && \
|
| 42 |
uv pip install --system --no-cache-dir -r requirements.txt
|
| 43 |
|
| 44 |
-
COPY --chown=user . /app
|
| 45 |
-
|
| 46 |
-
USER user
|
| 47 |
# Set home to the user's home directory
|
| 48 |
-
ENV HOME=/home/user \
|
| 49 |
-
PATH=/home/user/.local/bin:$PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
CMD ["uvicorn", "
|
|
|
|
|
|
| 30 |
|
| 31 |
# The two following lines are requirements for the Dev Mode to be functional
|
| 32 |
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
|
| 33 |
+
#RUN useradd -m -u 1000 user
|
| 34 |
WORKDIR /app
|
| 35 |
|
| 36 |
+
COPY requirements.txt .
|
| 37 |
+
#COPY --chown=user ./requirements.txt requirements.txt
|
| 38 |
#RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 39 |
|
| 40 |
# Install uv for faster dependency resolution, then install packages system-wide
|
| 41 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 42 |
pip install --no-cache-dir uv && \
|
| 43 |
uv pip install --system --no-cache-dir -r requirements.txt
|
| 44 |
|
| 45 |
+
#COPY --chown=user . /app
|
| 46 |
+
#USER user
|
|
|
|
| 47 |
# Set home to the user's home directory
|
| 48 |
+
#ENV HOME=/home/user \
|
| 49 |
+
#PATH=/home/user/.local/bin:$PATH
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
## Download Bootstrap
|
| 53 |
+
RUN mkdir -p static && \
|
| 54 |
+
curl -o static/bootstrap.min.css https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css && \
|
| 55 |
+
curl -o static/bootstrap.bundle.min.js https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js
|
| 56 |
+
|
| 57 |
+
# Preload Flan-T5-small (optional, but speeds first load; uses ~250MB)
|
| 58 |
+
RUN python -c "from transformers import pipeline; pipeline('text2text-generation', model='google/flan-t5-small')"
|
| 59 |
+
|
| 60 |
+
# Copy app code last
|
| 61 |
+
COPY . .
|
| 62 |
+
|
| 63 |
+
# Expose port (HF proxies it)
|
| 64 |
+
EXPOSE 7860
|
| 65 |
|
| 66 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 67 |
+
# "main:app"
|