Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -12
Dockerfile
CHANGED
|
@@ -11,22 +11,21 @@ ENV HOME=/home/user \
|
|
| 11 |
PATH=/home/user/.local/bin:$PATH
|
| 12 |
WORKDIR $HOME/app
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
RUN mkdir -p models
|
| 18 |
|
| 19 |
-
|
| 20 |
-
# Using a helper script style to keep the Dockerfile clean
|
| 21 |
-
# Format: URL_TO_ONNX URL_TO_JSON
|
| 22 |
|
|
|
|
| 23 |
RUN mkdir -p models && \
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
|
|
|
| 30 |
COPY --chown=user . .
|
|
|
|
| 31 |
EXPOSE 7860
|
| 32 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 11 |
PATH=/home/user/.local/bin:$PATH
|
| 12 |
WORKDIR $HOME/app
|
| 13 |
|
| 14 |
+
# 1. Copy requirements and voices list first
|
| 15 |
+
COPY --chown=user requirements.txt voices.txt ./
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
# 2. Download models directly into the models folder
|
| 20 |
RUN mkdir -p models && \
|
| 21 |
+
while read -r voice; do \
|
| 22 |
+
# -nd prevents wget from creating the en/en_GB/alan/ hierarchy
|
| 23 |
+
# -P models/ puts the flat file into the models folder
|
| 24 |
+
wget -q -nd https://huggingface.co/rhasspy/piper-voices/resolve/main/$voice -P models/; \
|
| 25 |
+
done < voices.txt
|
| 26 |
|
| 27 |
+
# 3. Copy the rest of the app
|
| 28 |
COPY --chown=user . .
|
| 29 |
+
|
| 30 |
EXPOSE 7860
|
| 31 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|