Skip to content

Add Docker Compose support for development with separate containers#106

Draft
Copilot wants to merge 3 commits into
masterfrom
copilot/fix-105
Draft

Add Docker Compose support for development with separate containers#106
Copilot wants to merge 3 commits into
masterfrom
copilot/fix-105

Conversation

Copy link
Copy Markdown

Copilot AI commented Aug 7, 2025

This PR implements comprehensive Docker Compose support for development, providing separate containers for each functionality as requested in the issue.

🐳 Services Implemented

  • webapp-mysql: Rails application with MySQL database (accessible at http://localhost:3000)
  • webapp-postgresql: Rails application with PostgreSQL database (accessible at http://localhost:3001)
  • db-mysql: MySQL 8.0 database server
  • db-postgresql: PostgreSQL 13 database server
  • redis: Redis cache server for production-like development

📁 Files Added

  • Dockerfile: Optimized Rails container with all necessary dependencies
  • docker-compose.yml: Complete service orchestration with health checks
  • entrypoint.sh: Smart database initialization and wait logic
  • config/database.yml.docker: Environment-based database configuration
  • docker-dev.sh: Developer-friendly command interface
  • test-docker-setup.sh: Comprehensive validation suite
  • demo-docker-setup.sh: Setup demonstration script
  • .dockerignore: Optimized build context
  • .env.example: Configuration template with all available options

🚀 Usage

Quick Start

# Start with MySQL
./docker-dev.sh up-mysql

# Start with PostgreSQL
./docker-dev.sh up-postgres

Development Commands

./docker-dev.sh shell-mysql      # Open development shell
./docker-dev.sh console-postgres # Rails console with PostgreSQL
./docker-dev.sh test-mysql       # Run tests with MySQL
./docker-dev.sh logs             # View all service logs
./docker-dev.sh down             # Stop all services
./docker-dev.sh clean            # Remove containers and volumes

Manual Docker Compose

docker compose up db-mysql redis webapp-mysql
docker compose exec webapp-mysql bundle exec rails console

🔧 Key Features

  • Separate containers for each database backend (MySQL/PostgreSQL)
  • Health checks ensure databases are ready before app startup
  • Volume mounting for live code reloading during development
  • Environment-based configuration using ERB templates
  • Comprehensive validation with automated tests
  • Preserved compatibility with existing development workflow

📚 Documentation

Updated README.rdoc with comprehensive Docker setup instructions while maintaining all existing installation methods. The original development workflow remains unchanged.

✅ Validation

All Docker Compose configurations have been validated:

  • Service definitions are correct and functional
  • Database configurations render properly for both MySQL and PostgreSQL
  • No conflicts with existing development setup
  • All validation tests pass

Fixes #105.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Copy Markdown
Author

Copilot AI commented Aug 7, 2025

@kaznum 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 2 commits August 7, 2025 06:09
Co-authored-by: kaznum <544290+kaznum@users.noreply.github.com>
Co-authored-by: kaznum <544290+kaznum@users.noreply.github.com>
Copilot AI changed the title [WIP] Docker compose support for development Add Docker Compose support for development with separate containers Aug 7, 2025
Copilot AI requested a review from kaznum August 7, 2025 06:13
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.

Docker compose support for development

2 participants