Update Dockerfile
Browse files- Dockerfile +6 -12
Dockerfile
CHANGED
|
@@ -1,29 +1,23 @@
|
|
| 1 |
-
# Use official Python image
|
| 2 |
FROM python:3.10
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 12 |
|
| 13 |
-
# Set up a new user named "user" with user ID 1000
|
| 14 |
-
# (Hugging Face Spaces require running as a non-root user)
|
| 15 |
RUN useradd -m -u 1000 user
|
| 16 |
USER user
|
| 17 |
|
| 18 |
-
# Set environment variables for the user
|
| 19 |
ENV HOME=/home/user \
|
| 20 |
PATH=/home/user/.local/bin:$PATH
|
| 21 |
|
| 22 |
-
# Change working directory to user's home
|
| 23 |
WORKDIR $HOME/app
|
| 24 |
-
|
| 25 |
-
# Copy the rest of the application files securely
|
| 26 |
COPY --chown=user . $HOME/app
|
| 27 |
|
| 28 |
-
# Command to run the FastAPI proxy using Uvicorn on Hugging Face's required port (7860)
|
| 29 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.10
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
+
# Install system dependencies for Kokoro + audio
|
| 6 |
+
RUN apt-get update && apt-get install -y \
|
| 7 |
+
espeak-ng \
|
| 8 |
+
libsndfile1 \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 12 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 13 |
|
|
|
|
|
|
|
| 14 |
RUN useradd -m -u 1000 user
|
| 15 |
USER user
|
| 16 |
|
|
|
|
| 17 |
ENV HOME=/home/user \
|
| 18 |
PATH=/home/user/.local/bin:$PATH
|
| 19 |
|
|
|
|
| 20 |
WORKDIR $HOME/app
|
|
|
|
|
|
|
| 21 |
COPY --chown=user . $HOME/app
|
| 22 |
|
|
|
|
| 23 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|