Spaces:
Runtime error
Runtime error
Fix: Download models during Docker build instead of copying from local
Browse files- Dockerfile +7 -1
Dockerfile
CHANGED
|
@@ -13,9 +13,15 @@ RUN useradd -m -u 1000 appuser
|
|
| 13 |
|
| 14 |
COPY --from=builder --chown=appuser:appuser /root/.local /home/appuser/.local
|
| 15 |
COPY --chown=appuser:appuser app ./app
|
| 16 |
-
COPY --chown=appuser:appuser models ./models
|
| 17 |
COPY --chown=appuser:appuser main.py .
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
USER appuser
|
| 20 |
|
| 21 |
ENV PATH=/home/appuser/.local/bin:$PATH \
|
|
|
|
| 13 |
|
| 14 |
COPY --from=builder --chown=appuser:appuser /root/.local /home/appuser/.local
|
| 15 |
COPY --chown=appuser:appuser app ./app
|
|
|
|
| 16 |
COPY --chown=appuser:appuser main.py .
|
| 17 |
|
| 18 |
+
# Download models during build instead of copying from local
|
| 19 |
+
COPY scripts/model_download.bash /tmp/model_download.bash
|
| 20 |
+
RUN pip install huggingface-hub && \
|
| 21 |
+
bash /tmp/model_download.bash && \
|
| 22 |
+
chown -R appuser:appuser models && \
|
| 23 |
+
rm /tmp/model_download.bash
|
| 24 |
+
|
| 25 |
USER appuser
|
| 26 |
|
| 27 |
ENV PATH=/home/appuser/.local/bin:$PATH \
|