Skip to content

fix(docker): use a CPU-only PyTorch image - #17

Open
rksharma-owg wants to merge 1 commit into
OWASP:mainfrom
rksharma-owg:codex/shrink-cpu-docker-image
Open

fix(docker): use a CPU-only PyTorch image#17
rksharma-owg wants to merge 1 commit into
OWASP:mainfrom
rksharma-owg:codex/shrink-cpu-docker-image

Conversation

@rksharma-owg

Copy link
Copy Markdown

Summary

  • install the CPU-only PyTorch wheel instead of CUDA runtime dependencies
  • rely on the separate Ollama service rather than starting a nonexistent embedded daemon
  • stabilize Ruff linting across releases
  • add packaging regression tests

Fixes #6.

Validation

  • native arm64 container build passes
  • image size falls from the published 6.11 GB manifest to 776.6 MB locally (87.3% smaller)
  • 204 tests pass and 65 are skipped
  • installed PyTorch reports no CUDA support
  • the exact CPython 3.11 x86_64 CPU wheel resolves successfully; local x86 execution was unavailable because this Docker installation lacks amd64 emulation
  • Ruff, Compose validation, and actionlint pass

AI assistance

OpenAI Codex assisted with the audit, implementation, tests, and PR description. I reviewed the complete diff and validation results.

Avoid pulling CUDA runtime dependencies for the CPU-only app container, and rely on the separate Ollama service instead of launching a nonexistent embedded daemon. Stabilize lint CI across Ruff releases and add packaging regression tests.\n\nCloses OWASP#6
@vijayleo31

Copy link
Copy Markdown

I pulled PR #17's branch and independently validated the Dockerfile changes locally (macOS, Apple Silicon, Docker Desktop, Python 3.11.15).

Build result:

docker build -t pwnzzai-local:dev .

Build completed successfully (12/12 steps, no errors). Resulting image content size: 954MB, down from the previously published 6.11GB manifest (~84% smaller) — consistent with the PR's reported 87.3% reduction.

Regression tests:

tests/unit/test_dockerfile.py::test_docker_image_installs_cpu_only_torch_before_app_requirements PASSED
tests/unit/test_dockerfile.py::test_app_image_does_not_start_a_second_ollama_server PASSED
2 passed in 0.01s

What the fix does:

  • Installs the CPU-only PyTorch wheel (torch==2.7.1 from https://download.pytorch.org/whl/cpu) before requirements.txt, avoiding the CUDA runtime dependencies that were bloating the image.
  • CMD now runs only flask run; the redundant ollama serve process previously started inside the app container is removed.

Caveat: I validated the build and image size locally but haven't reproduced the original repro steps (pulling a published image on Windows) to directly confirm the EOF-on-pull error is resolved. Given the ~84% size reduction, this is very likely to fix it, but a Windows pull test against a registry-published build from this branch would fully close the loop.
<img width="1256" height="170" alt="Screenshot 2026-07-28 at 7 01 00 PM" src="https://github.com/user-attachments/assets/42f
Screenshot 2026-07-28 at 7 02 17 PM
cba1d-2b6b-4c53-a8e7-1607c1e02297" />

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.

[29062026-OR-002] Docker image pull fails with EOF near completion

2 participants