Skip to content

Add Dockerfile and GitHub workflow generators to Gradle plugin#2

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/add-dockerfile-and-github-workflow-generator
Draft

Add Dockerfile and GitHub workflow generators to Gradle plugin#2
Copilot wants to merge 3 commits intomasterfrom
copilot/add-dockerfile-and-github-workflow-generator

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 29, 2026

Adds two code generation tasks to the microservice Gradle plugin: one for producing a Dockerfile, another for a full CI/CD GitHub Actions workflow that builds, publishes, creates Docker images, and cuts GitHub releases.

New tasks

  • generateDockerfile — Emits a Dockerfile with configurable baseImage, port, and jvmArgs. Copies the shadow JAR (*-all.jar) into a GraalVM-based image by default.
  • generateWorkflow — Emits .github/workflows/publish.yml with the full pipeline: Gradle build → checks → Maven publish → Docker build+push to GHCR → GitHub Release with JAR artifacts. Supports optional moduleRegex for filtering release JARs.

Usage

// In consumer project — tasks are registered automatically by the plugin
// Run with defaults:
//   ./gradlew generateDockerfile
//   ./gradlew generateWorkflow

// Or configure:
tasks.named<GenerateDockerfileTask>("generateDockerfile") {
    baseImage.set("ghcr.io/graalvm/jdk-community:25")
    port.set(9090)
    jvmArgs.set(listOf("-Xmx512m"))
}

tasks.named<GenerateWorkflowTask>("generateWorkflow") {
    moduleRegex.set("my-service-paper.*-all\\.jar$")
}

Files changed

  • task/GenerateDockerfileTask.kt — New abstract task with @Input/@OutputFile properties
  • task/GenerateWorkflowTask.kt — New abstract task generating workflow YAML with Docker build/push, version extraction, release flag logic, and softprops/action-gh-release
  • MicroservicePlugin.kt — Registers both tasks with conventions

Add GenerateDockerfileTask that generates a Dockerfile with configurable
base image, port, and JVM args for microservice projects.

Add GenerateWorkflowTask that generates a GitHub Actions workflow for
CI/CD including Maven publishing, Docker image build/push to GHCR,
and GitHub Release creation.

Register both tasks in MicroservicePlugin as 'generateDockerfile' and
'generateWorkflow'.

Agent-Logs-Url: https://github.com/SLNE-Development/surf-microservice/sessions/2eed8838-a00c-48de-827e-00e0d2c52fa4

Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
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.

2 participants