Fix model path and dockerfile
#1
by
yanp
- opened
- Dockerfile +7 -1
- scripts/model_download.bash +1 -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 \
|
scripts/model_download.bash
CHANGED
|
@@ -2,7 +2,7 @@ python - <<'PY'
|
|
| 2 |
from huggingface_hub import snapshot_download
|
| 3 |
snapshot_download(
|
| 4 |
repo_id="microsoft/resnet-18",
|
| 5 |
-
local_dir="models/resnet-18",
|
| 6 |
local_dir_use_symlinks=False # copies files; safer for containers
|
| 7 |
)
|
| 8 |
PY
|
|
|
|
| 2 |
from huggingface_hub import snapshot_download
|
| 3 |
snapshot_download(
|
| 4 |
repo_id="microsoft/resnet-18",
|
| 5 |
+
local_dir="models/microsoft/resnet-18",
|
| 6 |
local_dir_use_symlinks=False # copies files; safer for containers
|
| 7 |
)
|
| 8 |
PY
|