Spaces:
Sleeping
Sleeping
Dinuk-Di commited on
Commit ·
dbbbfec
1
Parent(s): 1c56f8e
Updated Dockerfile
Browse files- Dockerfile +11 -19
Dockerfile
CHANGED
|
@@ -4,40 +4,32 @@ ENV DEBIAN_FRONTEND=noninteractive \
|
|
| 4 |
PYTHONUNBUFFERED=1 \
|
| 5 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
HF_HOME=/app/.cache/huggingface \
|
| 7 |
-
TRANSFORMERS_CACHE=/app/.cache/huggingface \
|
| 8 |
PORT=7860
|
| 9 |
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
python3.11 python3.11-dev python3-pip \
|
| 12 |
ffmpeg libsndfile1 git curl \
|
| 13 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
RUN ln -sf /usr/bin/python3.11 /usr/bin/python3 && \
|
| 16 |
ln -sf /usr/bin/python3 /usr/bin/python
|
| 17 |
|
| 18 |
WORKDIR /app
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
COPY requirements.txt .
|
| 21 |
-
RUN pip install --no-cache-dir -
|
| 22 |
-
pip install --no-cache-dir torch torchvision torchaudio \
|
| 23 |
-
--index-url https://download.pytorch.org/whl/cu121 && \
|
| 24 |
-
pip install --no-cache-dir flash-attn --no-build-isolation && \
|
| 25 |
-
pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
COPY . .
|
| 28 |
|
| 29 |
-
RUN useradd -m -u 1000 appuser &&
|
| 30 |
-
chown -R appuser:appuser /app
|
| 31 |
USER appuser
|
| 32 |
|
| 33 |
EXPOSE 7860
|
| 34 |
-
|
| 35 |
-
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
|
| 36 |
-
CMD curl -f http://localhost:7860/ || exit 1
|
| 37 |
-
|
| 38 |
-
CMD ["python", "-m", "uvicorn", "main:app", \
|
| 39 |
-
"--host", "0.0.0.0", \
|
| 40 |
-
"--port", "7860", \
|
| 41 |
-
"--workers", "1", \
|
| 42 |
-
"--loop", "uvloop", \
|
| 43 |
-
"--log-level", "info"]
|
|
|
|
| 4 |
PYTHONUNBUFFERED=1 \
|
| 5 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
HF_HOME=/app/.cache/huggingface \
|
|
|
|
| 7 |
PORT=7860
|
| 8 |
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
python3.11 python3.11-dev python3-pip \
|
| 11 |
ffmpeg libsndfile1 git curl \
|
| 12 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
RUN ln -sf /usr/bin/python3.11 /usr/bin/python3 && \
|
| 15 |
ln -sf /usr/bin/python3 /usr/bin/python
|
| 16 |
|
| 17 |
WORKDIR /app
|
| 18 |
|
| 19 |
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel packaging
|
| 20 |
+
|
| 21 |
+
RUN pip install --no-cache-dir torch torchvision torchaudio \
|
| 22 |
+
--index-url https://download.pytorch.org/whl/cu121
|
| 23 |
+
|
| 24 |
+
RUN pip install --no-cache-dir flash-attn --no-build-isolation
|
| 25 |
+
|
| 26 |
COPY requirements.txt .
|
| 27 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
COPY . .
|
| 30 |
|
| 31 |
+
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
|
|
|
|
| 32 |
USER appuser
|
| 33 |
|
| 34 |
EXPOSE 7860
|
| 35 |
+
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|