This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Gradle plugin repository that provides three Docker-related Gradle plugins:
com.method.docker- Build and push Docker imagescom.method.docker-compose- Generate docker-compose files with resolved dependenciescom.method.docker-run- Run, stop, and manage Docker containers
./gradlew check./gradlew test --tests "com.palantir.gradle.docker.MethodDockerPluginTests"./gradlew build -x test -x check./gradlew publishNote: publishPlugins task only runs if the current state is a clean tag.
The codebase is organized into three main plugins, each with its own entry point:
-
MethodDockerPlugin (
com.method.docker)- Entry point:
src/main/groovy/com/palantir/gradle/docker/MethodDockerPlugin.groovy - Extension:
DockerExtension.groovy - Creates tasks:
docker,dockerPrepare,dockerClean,dockerTag*,dockerPush*,dockerfileZip - Builds Docker images based on configuration and Dockerfile
- Entry point:
-
DockerComposePlugin (
com.method.docker-compose)- Entry point:
src/main/groovy/com/palantir/gradle/docker/DockerComposePlugin.groovy - Extension:
DockerComposeExtension.groovy - Creates tasks:
generateDockerCompose,dockerComposeUp,dockerComposeDown - Resolves Docker image dependencies and populates template files
- Entry point:
-
DockerRunPlugin (
com.method.docker-run)- Entry point:
src/main/groovy/com/palantir/gradle/docker/DockerRunPlugin.groovy - Extension:
DockerRunExtension.groovy - Creates tasks:
dockerRun,dockerStop,dockerRunStatus,dockerRemoveContainer - Manages Docker container lifecycle
- Entry point:
- DockerExtension: Holds configuration for building Docker images (name, dockerfile, tags, buildArgs, labels, pull, noCache, buildx, platform, etc.)
- CopySpec Pattern: Uses Gradle's CopySpec to collect files for the Docker build context
- Task Dependencies: The
dockerPreparetask copies files intobuild/docker/before thedockertask runs - Tag Management: Supports both deprecated
tags()method and newertag(taskName, tagName)method for creating tagged images - Docker Component: Implements a custom Gradle component for Maven publishing of Docker image dependencies
Tests are located in src/test/groovy/com/palantir/gradle/docker/:
AbstractPluginTest.groovy- Base test class with helper methodsMethodDockerPluginTests.groovy- Tests for main Docker pluginDockerComposePluginTests.groovy- Tests for compose pluginDockerRunPluginTests.groovy- Tests for run plugin
Tests use GradleTestKit and Spock framework. The AbstractPluginTest provides utilities like with() for running Gradle tasks and exec() for executing shell commands.
- Java Target: Library targets Java 21
- Daemon Target: JDK 21 for Gradle daemon
- Test Gradle Versions: Tests run against Gradle 8.14.3
- Parallel Builds: Enabled via
org.gradle.parallel=true - Dependency Management: Uses
com.palantir.consistent-versionsplugin with versions defined inversions.props
This project uses several Palantir infrastructure plugins:
com.palantir.baseline- Code quality and formatting standardscom.palantir.java-format- Java code formatting (native formatter enabled)com.palantir.git-version- Version from git tagscom.palantir.external-publish- Publishing configurationcom.palantir.failure-reports- Test failure reportingcom.palantir.jdks- JDK provisioning and management
GitHub Actions is configured with a modular workflow structure:
-
Entry Point Workflows:
pr-review.yml- Runs on pull requests and pushes todevelop/mainbranchespublish.yml- Runs on merge todevelopbranch and on tags (publishing step currently disabled)
-
Reusable Workflows:
reusable-check.yml- Runs./gradlew check(tests, checkstyle, etc.) with parallel executionreusable-build.yml- Runs./gradlew build -x test -x checkto compile and package
- Uses Amazon Corretto JDK 21
- Gradle caching is enabled for faster builds
- Enforces that no git-tracked files are modified during the build process
- Uploads test results and build artifacts for inspection
- Publishes test results directly to PR for easy review