Skip to content

fix(docker): download model checkpoints from HuggingFace during build#21

Merged
kocabiyik merged 2 commits into
mainfrom
fix/docker-model-download
Apr 13, 2026
Merged

fix(docker): download model checkpoints from HuggingFace during build#21
kocabiyik merged 2 commits into
mainfrom
fix/docker-model-download

Conversation

@kocabiyik

Copy link
Copy Markdown
Contributor

Summary

  • Replaces COPY models/checkpoints/ with curl downloads from https://huggingface.co/withoutbg/focus/resolve/main/ for all 4 ONNX model files in both Dockerfiles
  • Adds curl to the apt-get install step in apps/web/backend/Dockerfile (production Dockerfile already had it)
  • Removes the ../../models/checkpoints:/app/checkpoints:ro volume mount from docker-compose.yml, which was shadowing the baked-in models whenever the local directory was absent or empty

Root cause (fixes #16)

COPY models/checkpoints/ ./checkpoints/ silently copied nothing since the directory isn't in the repo. The WITHOUTBG_*_MODEL_PATH env vars were set pointing to /app/checkpoints/, but the files didn't exist — triggering ModelNotFoundError immediately on startup.

Test plan

  • docker compose -f apps/web/docker-compose.yml build completes without errors
  • docker compose -f apps/web/docker-compose.yml up starts successfully and /api/health returns models_loaded: true
  • Production image builds and runs: docker build -f apps/web/Dockerfile .

🤖 Generated with Claude Code

kocabiyik and others added 2 commits April 13, 2026 22:03
Replace COPY models/checkpoints/ with curl downloads so the Docker image
is self-contained and works out-of-the-box without pre-downloaded models.
Also remove the docker-compose volume mount that was shadowing the baked-in
checkpoints when the local directory was absent or empty.

Fixes #16

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…error

huggingface_hub uses match statements (Python 3.10+). With python_version
set to 3.9 in mypy config, following imports into that package caused a
syntax error that blocked all type checking. Skip it via overrides since
we don't need to type-check third-party code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Apr 13, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@kocabiyik kocabiyik merged commit 754039c into main Apr 13, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker setup fails at runtime due to missing required model checkpoints

1 participant