Date: December 10, 2025
Version: 1.2.0
Issue: Render.com Docker build failure
error: failed to solve: failed to compute cache key:
failed to calculate checksum of ref: "/backend/requirements.txt": not found
The Dockerfile was using paths like COPY backend/requirements.txt . which worked when the Docker context was the root directory, but Render's build was failing because:
- Incorrect Docker Context: The
dockerContextwas set to.(root) whiledockerfilePathwas./backend/Dockerfile - Path Mismatch: Dockerfile expected
backend/prefix but files were relative to backend directory - Sample Directory: Trying to copy a sample directory that might not exist
Changes Made:
- ✅ Removed
backend/prefix from COPY commands - ✅ Changed
COPY backend/requirements.txt .→COPY requirements.txt . - ✅ Changed
COPY backend/app ./app→COPY app ./app - ✅ Removed problematic sample directory copy
- ✅ Added
mkdir -p sampleto create directory instead - ✅ Added HEALTHCHECK directive for better monitoring
File: backend/Dockerfile
# Before (BROKEN)
COPY backend/requirements.txt .
COPY backend/app ./app
COPY sample ./sample
# After (FIXED)
COPY requirements.txt .
COPY app ./app
RUN mkdir -p data reports sam_models sampleChanges Made:
- ✅ Changed
dockerContextfrom.to./backend - ✅ Changed
dockerfilePathfrom./backend/Dockerfileto./Dockerfile - ✅ Added
ENVIRONMENT=productionenvironment variable
File: render.yaml
# Before (BROKEN)
dockerfilePath: ./backend/Dockerfile
dockerContext: .
# After (FIXED)
dockerfilePath: ./Dockerfile
dockerContext: ./backendChanges Made:
- ✅ Added
ENVIRONMENT=developmentfor local development - ✅ Verified build context is
./backend
File: docker-compose.yml
backend:
build:
context: ./backend # ✅ Correct context
dockerfile: Dockerfile
environment:
- ENVIRONMENT=development # ✅ Added-
Push Changes to GitHub:
git add . git commit -m "fix: Update Dockerfile for Render deployment (V1.2)" git push origin main
-
Render Auto-Deploy:
- Render will automatically detect the push
- New build will start with fixed Dockerfile
- Build should complete successfully
-
Verify Deployment:
# Check health endpoint curl https://ciousten-video-insights-reports.onrender.com/health # Should return: { "status": "healthy", "version": "1.2.0", ... }
-
Rebuild Containers:
docker-compose down docker-compose build --no-cache docker-compose up
-
Verify:
curl http://localhost:8000/health
- Dockerfile builds without errors
- All dependencies installed
- App directory copied correctly
- Directories created (data, reports, sam_models, sample)
- Health check passes
- Build completes successfully
- Service shows "Live" status
- Health endpoint returns 200 OK
-
/docsshows Swagger UI - No errors in logs
- Frontend can reach backend
- No CORS errors
- API calls succeed
- Dashboard loads
# Production
curl https://ciousten-video-insights-reports.onrender.com/health
# Local
curl http://localhost:8000/health# Production
curl https://ciousten-video-insights-reports.onrender.com/
# Local
curl http://localhost:8000/# Production
curl https://ciousten-video-insights-reports.onrender.com/api/stats
# Local
curl http://localhost:8000/api/stats# Production
open https://ciousten-video-insights-reports.onrender.com/docs
# Local
open http://localhost:8000/docs#1 [1/8] FROM docker.io/library/python:3.10-slim
#1 DONE
#2 [2/8] WORKDIR /app
#2 DONE
#3 [3/8] RUN apt-get update && apt-get install...
#3 DONE
#4 [4/8] COPY requirements.txt .
#4 DONE
#5 [5/8] RUN pip install --no-cache-dir -r requirements.txt
#5 DONE
#6 [6/8] COPY app ./app
#6 DONE
#7 [7/8] RUN mkdir -p data reports sam_models sample
#7 DONE
✅ Build completed successfully
-
Check Render Logs:
- Go to Render Dashboard
- Click on "ciousten-api" service
- View "Logs" tab
- Look for specific error messages
-
Verify File Structure:
# In backend directory, verify files exist: ls -la # Should show: # - Dockerfile # - requirements.txt # - app/
-
Manual Build Test:
cd backend docker build -t ciousten-test . docker run -p 8000:8000 ciousten-test
-
Check Environment Variables:
- Verify
OPENROUTER_API_KEYis set in Render - Verify
PORT=8000is set - Verify
PYTHONUNBUFFERED=1is set
- Verify
| File | Changes | Purpose |
|---|---|---|
backend/Dockerfile |
Fixed COPY paths, added HEALTHCHECK | Render compatibility |
render.yaml |
Updated dockerContext and dockerfilePath | Correct build context |
docker-compose.yml |
Added ENVIRONMENT variable | Local dev consistency |
- Dockerfile builds successfully on Render
- Backend service deploys without errors
- Health endpoint returns healthy status
- API documentation accessible
- Frontend can connect to backend
- All V1.2 features working
-
Monitor Deployment:
- Watch Render build logs
- Verify service goes live
- Test all endpoints
-
Update Frontend:
- Ensure
NEXT_PUBLIC_API_URLpoints to new backend - Redeploy if needed
- Ensure
-
Test End-to-End:
- Upload video
- Run analysis
- Generate reports
-
Update Documentation:
- Mark deployment as successful
- Update any URLs
- Document any issues
Status: ✅ Fixed and Ready for Deployment
Version: 1.2.0
Made by Aditya Shenvi @2025