{"id":17343866,"url":"https://github.com/augi/gradle-docker-java","last_synced_at":"2025-10-07T07:32:07.851Z","repository":{"id":27577550,"uuid":"114413442","full_name":"augi/gradle-docker-java","owner":"augi","description":"Gradle plugin that wraps your JVM application to a new Docker image.","archived":false,"fork":false,"pushed_at":"2025-02-25T11:58:34.000Z","size":604,"stargazers_count":10,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T14:05:52.390Z","etag":null,"topics":["docker","gradle","gradle-plugin","jvm"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/augi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-15T21:42:09.000Z","updated_at":"2025-02-25T11:58:35.000Z","dependencies_parsed_at":"2023-10-05T11:15:12.246Z","dependency_job_id":"fc2242dc-8a19-48bc-8c6f-79174b549e06","html_url":"https://github.com/augi/gradle-docker-java","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augi%2Fgradle-docker-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augi%2Fgradle-docker-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augi%2Fgradle-docker-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/augi%2Fgradle-docker-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/augi","download_url":"https://codeload.github.com/augi/gradle-docker-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245013741,"owners_count":20547175,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","gradle","gradle-plugin","jvm"],"created_at":"2024-10-15T16:10:30.602Z","updated_at":"2025-10-07T07:32:07.788Z","avatar_url":"https://github.com/augi.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gradle Docker Java Plugin [![Build](https://github.com/augi/gradle-docker-java/actions/workflows/build.yml/badge.svg)](https://github.com/augi/gradle-docker-java/actions/workflows/build.yml) [![Version](https://badgen.net/maven/v/maven-central/cz.augi/gradle-docker-java)](https://repo1.maven.org/maven2/cz/augi/gradle-docker-java/)\n\nGradle plugin that wraps your JVM application to a new Docker image.\n The image has [standard labels](http://label-schema.org/rc1/) and [OCI annotations](https://github.com/opencontainers/image-spec/blob/main/annotations.md) derived from the build environment (environment variables, Git).\n Almost all the logic on Dockerfile generation is in [this file](src/main/groovy/cz/augi/gradle/dockerjava/DistDockerTask.groovy).\n\nThe plugin takes product of `distTar` task (added by [the application plugin](https://docs.gradle.org/current/userguide/application_plugin.html)) and wraps it to Docker image.\n It copies files in two steps - first, it copies all files except the application JAR. And finally, it copies the application JAR. So if you change just application code, the layer with dependencies remains the same.\n\nThe plugin just generates the `Dockerfile` and then executes the `docker` commands, so it works even on Windows with Windows Containers. This can be the reason why to use this plugin instead of https://github.com/GoogleContainerTools/jib (that doesn't support Windows containers). You could also consider https://github.com/bmuschko/gradle-docker-plugin that uses Docker remove API.\n\nUsage\n=====\nThe plugin is published to [Gradle Plugins portal](https://plugins.gradle.org/plugin/cz.augi.docker-java). Only the `image` parameter is mandatory - it's the name of the resulting image.\n\nThere are actually two use-cases:\n1. You have your own `Dockerfile` - then you can specify path to it using `customDockerfile`, and the plugin actually just executes `docker build` to get the Docker image\n2. You don't have your own `Dockerfile`, then you have to specify `baseImage` only, and the `Dockerfile` will be generated for you.\n```gradle\n    plugins {\n        id 'cz.augi.docker-java' version 'putCurrentVersionHere'\n    }\n\t\n    dockerJava {\n        image = \"myorg/my-app:$version\" // name of the resulting Docker image; mandatory\n        alternativeImages = [\"myorg/my-app:latest\"] // array of alternative image names; default is empty\n\n        baseImage = 'my-org/our-base-image:1.2.3' // required if customDockerfile is not specified\n        ports = [80] // list of exposed ports; default: empty\n        labels = ['mylabel':'mylabelvalue'] // additonal labels of Dockerfile; default: empty\n        volumes = ['/my-folder'] // list of volumes; default: empty\n        dockerfileLines = ['RUN apt-get ...'] // additional lines to include to Dockerfile; default: empty\n        arguments = ['--server'] // arguments to be passed to your application; default: empty\n        filesToCopy = [project.file('my-file-txt')] // list of files to copy to the Docker working directory (so these file can be copied to the image using COPY or ADD directives)\n\n        customDockerfile = file('Dockerfile') // path to a custom Dockerfile - then all of the previous options (except image and alternativeImages) are ignored; default: null\n        buildArgs = ['version=1.2.3'] // build arguments to be send to 'docker build' command when using custom Dockerfile; default: empty\n\n        dockerBuildDirectory = project.file('my-directory') // directory where Dockerfile is created; default: \"$buildDir/dockerJava\"\n        dockerBuildArgs = ['--isolation=hyperv'] // additional arguments to be send to 'docker build' command\n\n        // username and password are used if the Docker Registry requires credentials for pushing\n        username = 'registry-username'\n        password = System.getenv('DOCKER_REGISTRY_PASSWORD')\n        registry = 'docker.company.com' // Docker registry used to login; default: tries to extract it from 'image'\n        removeImage = false // indicates if the image should be removed after publishing, default is true        \n    }\n```\n\nThe plugin provides following tasks:\n * `distDocker` - creates temporary Dockerfile and build it to a new Docker image\n * `dockerPush` - pushes the Docker image to Docker Registry\n\nThe plugin executes `docker` command under the hood, so it supposes that [Docker Engine](https://www.docker.com/docker-engine) is installed and available in `PATH`.\n\nMotivation\n==========\nAlmost all the JVM-based applications have the same Dockerfile so why to copy or write the same Dockerfile again and again?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faugi%2Fgradle-docker-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faugi%2Fgradle-docker-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faugi%2Fgradle-docker-java/lists"}