DEV Community

Cover image for Reel Quick - Added Docker Support
Farhan Munir
Farhan Munir

Posted on

Reel Quick - Added Docker Support

Date: 2026-04-15

Project: Reel Quick (FastAPI + Next.js + ARQ + Mongo + Redis + optional GPU workers)

Context

We containerized the stack and tried to run it in production mode with Docker Compose.

Initial startup failed for both frontend build and backend runtime.

Issues Found

  1. Docker Compose path mismatches:
  2. Wrong env_file paths (docker/env/*.env expected but files were in docker/).
  3. Wrong nginx config mount path (./docker/nginx/nginx.conf while actual file was docker/nginx.conf).
  4. Build context was incorrect for a compose file located inside docker/.

  5. Frontend TypeScript build failure:

  6. location field type mismatch in frontend/app/create_video/page.tsx.

  7. Value inferred as string | undefined but state expects string | null.

  8. Backend container crash on startup:

  9. ModuleNotFoundError: No module named 'db'.

  10. backend/main.py used non-package imports like from db import ....

Root Causes

  • Relative paths in compose were not aligned with actual file layout.
  • Optional API response property (file_location?) was used directly inside state update.
  • Backend entrypoint (uvicorn backend.main:app) requires package-safe imports (backend.*).

Fixes Applied

Docker and Compose

  • Updated docker/docker-compose.yml:
    • build.context changed from . to ...
    • env_file paths corrected to backend.env and mongo.env.
    • nginx bind mount fixed to ./nginx.conf.
  • Updated docker/backend.env:
    • Added:
    • UPLOAD_FILES_LOCATION=/app/video_files
    • INPUT_FILES_LOCATION=/app/video_files
  • Added repo-root .dockerignore (Docker uses ignore file from build context root).
  • Synced docker/dockerignore entries.
  • Updated docker/README-docker-prod.md run commands.

Frontend

  • Fixed type narrowing in frontend/app/create_video/page.tsx:
    • Captured file_location into uploadedLocation.
    • Guarded before setFiles(...).
    • Used guaranteed string value in state update.

Backend

  • Converted backend imports to package imports in backend/main.py:
    • from db import ... -> from backend.db import ...
    • Similar conversion for logger, models, objects, workers.
  • Updated backend/objects/sound_prompt_preset.py import to backend.objects....

Commands Used for Deploy

# Stop all running containers (host-wide)
docker ps -q | xargs -r docker stop

# Start Reel Quick with GPU workers
cd /home/farhan/reel-quick/docker
docker compose --profile gpu up -d --build

# Verify
docker compose ps
docker compose logs -f api --tail=200
Enter fullscreen mode Exit fullscreen mode

Validation Checklist

  • docker compose ps shows api, frontend, nginx, mongo, redis, workers as running.
  • api logs no longer show ModuleNotFoundError: No module named 'db'.
  • Frontend image builds successfully (npm run build passes in container build stage).
  • Upload endpoint works (POST /uploads).
  • Workers/control panel endpoints return expected data.

Key Takeaways

  • Keep compose file paths consistent with its directory and build context.
  • Use package-qualified imports for Python app modules in containerized runtimes.
  • Narrow optional API fields before state updates in strict TypeScript projects.
  • Add .dockerignore at the actual build context root to avoid bloated builds.

Top comments (0)