Skip to content

Optimize Docker build to avoid timeout#5

Open
railway-app[bot] wants to merge 1 commit into
mainfrom
railway/code-change-jpHRfV
Open

Optimize Docker build to avoid timeout#5
railway-app[bot] wants to merge 1 commit into
mainfrom
railway/code-change-jpHRfV

Conversation

@railway-app

@railway-app railway-app Bot commented Apr 19, 2026

Copy link
Copy Markdown

Problem

The Docker build was timing out during image import because sentence-transformers pulls in the full CUDA-enabled PyTorch distribution as a transitive dependency — roughly 2 GB of CUDA libraries (nvidia-cublas, nvidia-cuda-runtime, etc.) that are completely unused since the app runs inference on CPU via Groq's cloud API. This bloated the final image well past Railway's import timeout.

Solution

Three targeted changes bring the image back under the timeout. First, requirements.txt now pins torch==2.2.2+cpu from PyTorch's CPU-only wheel index, which strips all CUDA libraries from the install. Second, --no-cache-dir is added to the pip install step in the Dockerfile so pip's download cache doesn't linger in the image layer. Third, HF_HOME and TRANSFORMERS_CACHE are set to /app/data/hf_cache (both in the Dockerfile and start.sh) so the all-MiniLM-L6-v2 model — which was already downloaded at container startup, not build time — is cached inside the existing data volume and reused across restarts rather than re-downloaded on every deploy.

Changes

  • Modified server/python_bot/requirements.txt
  • Modified Dockerfile
  • Modified start.sh

Generated by Railway

@vercel

vercel Bot commented Apr 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subscription-manager Ready Ready Preview, Comment Apr 19, 2026 7:42am
subscription-manager-agam Ready Ready Preview, Comment Apr 19, 2026 7:42am

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.

0 participants