From ddf6398519824750c77a0a8e9e43bb0474bc6d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20August=C3=BDn?= Date: Fri, 19 Jul 2024 09:08:56 +0200 Subject: [PATCH] docs: usage description improved Fixes #446 --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7f2d7b64..b91290a6 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,16 @@ Simplifies usage of [Docker Compose](https://docs.docker.com/compose/) for local `composeLogs` task stores logs from all containers to files in `containerLogToDir` directory. ## Quick start +The plugin is published to [Gradle Plugin Portal](https://plugins.gradle.org/plugin/com.avast.gradle.docker-compose), so the import is easy as + +```gradle +plugins { + id "com.avast.gradle.docker-compose" version "$versionHere" +} +``` + +Since the version `0.14.2`, the plugin is also published to Maven Central, so if your prefer this way: + ```gradle buildscript { repositories { @@ -28,14 +38,14 @@ buildscript { } apply plugin: 'docker-compose' +``` -// Or use the new Gradle Portal plugins (then you don't have to add the dependency as above): -// plugins { -// id 'com.avast.gradle.docker-compose' version "$versionHere" -// } - +After importing the plugin, the basic usage is typically just: +```gradle dockerCompose.isRequiredBy(test) ``` + +It ensures: * `docker-compose up` is executed in the project directory, so it uses the `docker-compose.yml` file. * If the provided task (`test` in the example above) executes a new process then environment variables and Java system properties are provided. * The name of environment variable is `${serviceName}_HOST` and `${serviceName}_TCP_${exposedPort}` (e.g. `WEB_HOST` and `WEB_TCP_80`).