DEV Community

Query Filter
Query Filter

Posted on

docker4

Here is the complete README.md content in a single block for you to copy and paste:

CPLS Development Environment (Docker Compose)

This configuration provides a containerized development environment for the CPLS Java application. It ensures consistency across different developer machines and regions by isolating the runtime, build tools, and dependencies.

Service Configuration: coes—dev

1. Build & Image

  • build: .: The build context is set to the current directory, utilizing the local Dockerfile to provision the environment.
  • image: cpls: Automatically tags the resulting image as cpls for streamlined local management.

2. Network & Ports

  • 9999:9999: Maps the container's internal port to the host machine. This is used for application access and attaching remote debuggers (e.g., via IntelliJ) at localhost:9999.

3. Volume Mapping & Persistence

To optimize build performance and developer experience, three mount points are utilized:

  • gradle-cache: A named volume that persists the .gradle directory. This significantly reduces build times by caching dependencies across container restarts.
  • cchollydata: Dedicated persistent storage for application-specific data located at /opt/ccholly.
  • . (Host) -> /opt/CPLS (Container): A bind mount of the project source code. This enables "Hot Reloading" capabilities where code changes in the IDE are immediately reflected in the containerized environment.

4. JVM Optimization (JAVA_OPTS)

Memory settings are tuned for enterprise Spring Boot performance:

  • -Xms2048m: Sets the Initial Heap Size to 2GB to prevent frequent heap resizing during application startup.
  • -Xmx5120m: Sets the Maximum Heap Size to 5GB, providing ample headroom for memory-intensive operations and local testing.

5. Operational Commands

  • working_dir: /opt/CPLS: Establishes the default directory for all terminal sessions and commands executed within the container.
  • command: tail -f /dev/null: A "keep-alive" instruction that prevents the container from exiting. This allows developers to manually trigger Gradle tasks or enter the container shell using docker exec.

Quick Start Guide

  1. Start the environment in detached mode: docker-compose up -d
  2. Access the container shell: docker exec -it coes-dev bash
  3. Execute a build: ./gradlew clean build

Top comments (0)