開発環境
macOS Mojave
gradleをインストール
brew install gradle
バージョン確認
radle -v
------------------------------------------------------------
Gradle 5.3.1
------------------------------------------------------------
Build time: 2019-03-28 09:09:23 UTC
Revision: f2fae6ba563cfb772c8bc35d31e43c59a5b620c3
Kotlin: 1.3.21
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 11.0.2 (Oracle Corporation 11.0.2+9-LTS)
OS: Mac OS X 10.14.3 x86_64
gradleの初期化
gradle init
build.gradleをの設定
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.avast.gradle:gradle-docker-compose-plugin:0.9.1"
}
}
apply plugin: "com.avast.gradle.docker-compose"
https://plugins.gradle.org/plugin/com.avast.gradle.docker-compose
上記の設定をそのまんまコピーしました。
ビルドしてtaskの確認をする
まずはビルド
./gradlew build
> Task :buildEnvironment
------------------------------------------------------------
Root project
------------------------------------------------------------
classpath
\--- gradle.plugin.com.avast.gradle:gradle-docker-compose-plugin:0.9.1
\--- org.yaml:snakeyaml:1.23
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
AMEMIYAnoMacBook-Pro:task_application_ruby amemiyakenji$ ./gradlew tasks
> Task :tasks
タスクを確認
./gradlew tasks
> Task :tasks
------------------------------------------------------------
Tasks runnable from root project
------------------------------------------------------------
Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.
Docker tasks
------------
composeBuild - Builds images for services of docker-compose project
composeDown - Stops and removes containers of docker-compose project (only if stopContainers is set to true)
composeDownForced - Stops and removes containers of docker-compose project
composeLogs - Stores log output from services in containers of docker-compose project
composePull - Builds and pulls images of docker-compose project
composePush - Pushes images for services of docker-compose project
composeUp - Builds and starts containers of docker-compose project
Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'task_application_ruby'.
components - Displays the components produced by root project 'task_application_ruby'. [incubating]
dependencies - Displays all dependencies declared in root project 'task_application_ruby'.
dependencyInsight - Displays the insight into a specific dependency in root project 'task_application_ruby'.
dependentComponents - Displays the dependent components of components in root project 'task_application_ruby'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'task_application_ruby'. [incubating]
projects - Displays the sub-projects of root project 'task_application_ruby'.
properties - Displays the properties of root project 'task_application_ruby'.
tasks - Displays the tasks runnable from root project 'task_application_ruby'.
To see all tasks and more detail, run gradlew tasks --all
To see more detail about a task, run gradlew help --task <task>
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
これで設定完了