Skip to content

[DevOps] Docker Compose Setup for One-Command Local Development #336

Description

@arpit2006

Description

Setting up PatchPilot for local development currently requires contributors to manually install multiple dependencies—including Python, Node.js, Semgrep, OSV-Scanner, and Gitleaks—and run the frontend and backend as separate processes. This onboarding process is time-consuming and increases the likelihood of environment-specific issues.

Introduce a docker-compose.yml configuration that provisions the complete development environment with a single command, providing a consistent and reproducible setup across all platforms.

Proposed Solution

Create a root-level docker-compose.yml that orchestrates the backend, frontend, and security scanner dependencies.

The Compose setup should:

  • Build and run all required services.
  • Support live code reloading for development.
  • Eliminate the need to manually install scanner tools on the host machine.
  • Serve as the recommended local development workflow.

Services

Backend

  • Build from backend/Dockerfile
  • Mount ./backend as a bind volume for live reload
  • Expose the backend API
  • Load environment variables from .env

Frontend

  • Build from frontend/Dockerfile
  • Mount ./frontend for hot module replacement
  • Run:
npm run dev
  • Expose port 5173

Scanner Tools

Provide a service (or shared base image) containing:

  • Semgrep
  • OSV-Scanner
  • Gitleaks

The scanner binaries should be available to the backend via a shared volume or common image layer to avoid requiring local installations.

Developer Workflow

Starting the application should be as simple as:

docker compose up

Stopping and cleaning the environment should be:

docker compose down -v

No additional manual setup should be required beyond Docker and Docker Compose.

Documentation

Update the project documentation to make Docker the recommended development workflow.

README.md

Add a Docker Quickstart section covering:

  • Prerequisites
  • Starting the development environment
  • Accessing the frontend and backend
  • Stopping the stack
  • Common troubleshooting tips

This section should replace the existing multi-step manual setup as the primary onboarding path for new contributors.

Environment Variables

Add or update .env.example to document all environment variables consumed by:

  • Backend
  • Frontend
  • Scanner tools (if applicable)

Include sensible development defaults where appropriate.

Continuous Integration

Extend the GitHub Actions workflow to validate the Docker configuration on every pull request.

The CI should verify that:

docker compose build

completes successfully without errors.

This helps prevent broken Docker configurations from being merged.

Acceptance Criteria

  • Add a root-level docker-compose.yml.
  • Define the following services:
    • Backend
    • Frontend
    • Scanner Tools (or equivalent shared image)
  • Backend builds from backend/Dockerfile and supports live reload via bind mounts.
  • Frontend builds from frontend/Dockerfile and runs npm run dev on port 5173.
  • Scanner service includes Semgrep, OSV-Scanner, and Gitleaks without requiring host installation.
  • docker compose up starts the complete development environment.
  • docker compose down -v removes containers, networks, and volumes cleanly.
  • Update README.md with a Docker Quickstart section recommending Docker as the default setup.
  • Update .env.example to document all required environment variables.
  • Add a GitHub Actions CI step that verifies docker compose build succeeds on every pull request.

Expected Impact

  • 🐳 One-command local setup for new contributors.
  • ⚡ Faster onboarding with fewer environment-related issues.
  • 🔁 Consistent development environments across Windows, macOS, and Linux.
  • 🛠️ Eliminates manual installation of security scanner tools.
  • 🚀 Improves contributor experience and increases development productivity.
  • ✅ Ensures Docker configuration remains functional through automated CI validation.

Difficulty: Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions