aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2017-10-30 23:25:25 +0100
committerRoel Spilker <r.spilker@gmail.com>2017-10-30 23:25:25 +0100
commit975880abdbba376e75f06a5bd6bf0bb7f0a2a885 (patch)
tree6e71a61eb9302b40705940aa47e6ae30722c8a2f /docker
parentc714a3bbca015ddd639b242323e20928980724e3 (diff)
downloadlombok-975880abdbba376e75f06a5bd6bf0bb7f0a2a885.tar.gz
lombok-975880abdbba376e75f06a5bd6bf0bb7f0a2a885.tar.bz2
lombok-975880abdbba376e75f06a5bd6bf0bb7f0a2a885.zip
use provisioning in docker to enable composition of versions
Diffstat (limited to 'docker')
-rw-r--r--docker/gradle/Dockerfile22
-rw-r--r--docker/gradle/readme.md33
-rw-r--r--docker/maven/Dockerfile21
-rw-r--r--docker/maven/files/pom.xml22
-rw-r--r--docker/maven/readme.md33
-rw-r--r--docker/provision/gradle/gradle-4.2.1.sh4
-rw-r--r--docker/provision/jdk/java-1.8.sh6
-rw-r--r--docker/provision/jdk/java-1.9.sh4
-rw-r--r--docker/provision/maven/maven-3.5.0.sh4
-rw-r--r--docker/readme.md30
10 files changed, 130 insertions, 49 deletions
diff --git a/docker/gradle/Dockerfile b/docker/gradle/Dockerfile
index 73d5fa1b..6c5cba15 100644
--- a/docker/gradle/Dockerfile
+++ b/docker/gradle/Dockerfile
@@ -1,19 +1,19 @@
FROM ubuntu:16.04 as downloader
-RUN apt-get update && apt-get install wget -y
-RUN wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz -O jdk9_linux-x64_bin.tar.gz
-RUN tar -xzf jdk9_linux-x64_bin.tar.gz -C /opt/
+ARG jdk=1.9
+ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh
+RUN provision/jdk/java-${jdk}.sh
-RUN wget https://services.gradle.org/distributions/gradle-4.2.1-bin.zip -O gradle.zip
-RUN apt-get update && apt-get install unzip -y
-RUN mkdir /opt/gradle && unzip -d /opt/gradle gradle.zip
+ARG gradle=4.2.1
+ADD provision/gradle/gradle-${gradle}.sh provision/gradle/gradle-${gradle}.sh
+RUN provision/gradle/gradle-${gradle}.sh
FROM ubuntu:16.04
COPY --from=downloader /opt/gradle/ /opt/gradle/
-COPY --from=downloader /opt/jdk-9.0.1/ /opt/jdk-9.0.1/
+COPY --from=downloader /opt/jdk/ /opt/jdk/
-RUN update-alternatives --install /usr/bin/java java /opt/jdk-9.0.1/bin/java 1000 && update-alternatives --install /usr/bin/javac javac /opt/jdk-9.0.1/bin/javac 1000 && update-alternatives --install /usr/bin/javadoc javadoc /opt/jdk-9.0.1/bin/javadoc 1000 && update-alternatives --install /usr/bin/javap javap /opt/jdk-9.0.1/bin/javap 1000
+RUN update-alternatives --install /usr/bin/java java /opt/jdk/bin/java 1000 && update-alternatives --install /usr/bin/javac javac /opt/jdk/bin/javac 1000 && update-alternatives --install /usr/bin/javadoc javadoc /opt/jdk/bin/javadoc 1000 && update-alternatives --install /usr/bin/javap javap /opt/jdk/bin/javap 1000
WORKDIR workspace
@@ -22,8 +22,10 @@ ADD gradle/files/ ./
ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar
-ENV JAVA_HOME=/opt/jdk-9.0.1
-ENV GRADLE_HOME=/opt/gradle/gradle-4.2.1
+ARG jdk
+ENV JDK_VERSION=${jdk}
+ENV JAVA_HOME=/opt/jdk
+ENV GRADLE_HOME=/opt/gradle/gradle
ENV PATH="${JAVA_HOME}/bin:${GRADLE_HOME}/bin:${PATH}"
ENTRYPOINT bash
diff --git a/docker/gradle/readme.md b/docker/gradle/readme.md
new file mode 100644
index 00000000..efe4f237
--- /dev/null
+++ b/docker/gradle/readme.md
@@ -0,0 +1,33 @@
+## Configuration
+
+[_(general configuration and options)_](../readme.md)
+
+### `ARG gradle=4.2.1`
+
+The gradle version to be used. Supported values:
+
+- `4.2.1` (default)
+
+## Example build commands:
+
+(To be executed from the `<lombokhome>/docker` directory)
+
+```
+docker build -t lombok-gradle-jdk9 -f gradle/Dockerfile .
+
+docker build -t lombok-gradle-jdk9 --build-arg lombokjar=lombok-1.16.18.jar -f gradle/Dockerfile .
+```
+
+## Example run commands:
+
+```
+docker run -it lombok-gradle-jdk9
+
+docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar lombok-gradle-jdk9
+```
+
+## Example container commands:
+
+```
+gradle assemble
+```
diff --git a/docker/maven/Dockerfile b/docker/maven/Dockerfile
index a41932c9..ac977a7a 100644
--- a/docker/maven/Dockerfile
+++ b/docker/maven/Dockerfile
@@ -1,18 +1,19 @@
FROM ubuntu:16.04 as downloader
-RUN apt-get update && apt-get install wget -y
-RUN wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz -O jdk9_linux-x64_bin.tar.gz
-RUN tar -xzf jdk9_linux-x64_bin.tar.gz -C /opt/
+ARG jdk=1.9
+ADD provision/jdk/ provision/jdk/
+RUN provision/jdk/java-${jdk}.sh
-RUN wget http://www-us.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz -O maven.tar.gz
-RUN mkdir /usr/local/apache-maven/ && tar xvf maven.tar.gz -C /usr/local/apache-maven/
+ARG maven=3.5.0
+ADD provision/maven/maven-${maven}.sh provision/maven/maven-${maven}.sh
+RUN provision/maven/maven-${maven}.sh
FROM ubuntu:16.04
COPY --from=downloader /usr/local/apache-maven/ /usr/local/apache-maven/
-COPY --from=downloader /opt/jdk-9.0.1/ /opt/jdk-9.0.1/
+COPY --from=downloader /opt/jdk/ /opt/jdk/
-RUN update-alternatives --install /usr/bin/java java /opt/jdk-9.0.1/bin/java 1000 && update-alternatives --install /usr/bin/javac javac /opt/jdk-9.0.1/bin/javac 1000 && update-alternatives --install /usr/bin/javadoc javadoc /opt/jdk-9.0.1/bin/javadoc 1000 && update-alternatives --install /usr/bin/javap javap /opt/jdk-9.0.1/bin/javap 1000
+RUN update-alternatives --install /usr/bin/java java /opt/jdk/bin/java 1000 && update-alternatives --install /usr/bin/javac javac /opt/jdk/bin/javac 1000 && update-alternatives --install /usr/bin/javadoc javadoc /opt/jdk/bin/javadoc 1000 && update-alternatives --install /usr/bin/javap javap /opt/jdk/bin/javap 1000
WORKDIR workspace
@@ -21,8 +22,10 @@ ADD maven/files/ ./
ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar
-ENV JAVA_HOME=/opt/jdk-9.0.1
-ENV M2_HOME=/usr/local/apache-maven/apache-maven-3.5.0
+ARG jdk
+ENV JDK_VERSION=${jdk}
+ENV JAVA_HOME=/opt/jdk
+ENV M2_HOME=/usr/local/apache-maven/apache-maven
ENV M2=${M2_HOME}/bin
ENV PATH="${M2}:${JAVA_HOME}/bin:${PATH}"
diff --git a/docker/maven/files/pom.xml b/docker/maven/files/pom.xml
index 9ecd8868..0771e3a9 100644
--- a/docker/maven/files/pom.xml
+++ b/docker/maven/files/pom.xml
@@ -2,12 +2,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
- <artifactId>lombok-jdk9</artifactId>
+ <artifactId>lombok-jdk-${env.JDK_VERSION}</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <java.version>1.9</java.version>
+ <java.version>${env.JDK_VERSION}</java.version>
</properties>
<build>
@@ -25,15 +25,15 @@
<compilerargs>
<arg>-Werror</arg>
<arg>-Xlint:all</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
- <arg>-J--add-opens=-Jjdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
+ <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
</compilerargs>
</configuration>
</plugin>
diff --git a/docker/maven/readme.md b/docker/maven/readme.md
new file mode 100644
index 00000000..20cf126f
--- /dev/null
+++ b/docker/maven/readme.md
@@ -0,0 +1,33 @@
+## Configuration
+
+[_(general configuration and options)_](../readme.md)
+
+### `ARG maven=3.5.0`
+
+The maven version to be used. Supported values:
+
+- `3.5.0` (default)
+
+## Example build commands:
+
+(To be executed from the `<lombokhome>/docker` directory)
+
+```
+docker build -t lombok-maven-jdk9 -f maven/Dockerfile .
+
+docker build -t lombok-maven-jdk9 --build-arg lombokjar=lombok-1.16.18.jar -f maven/Dockerfile .
+```
+
+## Example run commands:
+
+```
+docker run -it lombok-maven-jdk9
+
+docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar lombok-maven-jdk9
+```
+
+## Example container commands:
+
+```
+mvn compile
+```
diff --git a/docker/provision/gradle/gradle-4.2.1.sh b/docker/provision/gradle/gradle-4.2.1.sh
new file mode 100644
index 00000000..8c300f11
--- /dev/null
+++ b/docker/provision/gradle/gradle-4.2.1.sh
@@ -0,0 +1,4 @@
+apt-get update && apt-get install -y wget unzip
+wget https://services.gradle.org/distributions/gradle-4.2.1-bin.zip -O gradle.zip
+mkdir /opt/gradle && unzip -d /opt/gradle gradle.zip
+mv /opt/gradle/gradle-4.2.1 /opt/gradle/gradle
diff --git a/docker/provision/jdk/java-1.8.sh b/docker/provision/jdk/java-1.8.sh
new file mode 100644
index 00000000..44795c6c
--- /dev/null
+++ b/docker/provision/jdk/java-1.8.sh
@@ -0,0 +1,6 @@
+apt-get update && apt-get install -y software-properties-common
+echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
+add-apt-repository -y ppa:webupd8team/java
+apt-get update && apt-get install -y oracle-java8-installer
+
+mv /usr/lib/jvm/java-8-oracle /opt/jdk
diff --git a/docker/provision/jdk/java-1.9.sh b/docker/provision/jdk/java-1.9.sh
new file mode 100644
index 00000000..2023ae39
--- /dev/null
+++ b/docker/provision/jdk/java-1.9.sh
@@ -0,0 +1,4 @@
+apt-get update && apt-get install -y wget
+wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz -O jdk.tar.gz
+tar -xzf jdk.tar.gz -C /opt/
+mv /opt/jdk-9.0.1 /opt/jdk
diff --git a/docker/provision/maven/maven-3.5.0.sh b/docker/provision/maven/maven-3.5.0.sh
new file mode 100644
index 00000000..3167a964
--- /dev/null
+++ b/docker/provision/maven/maven-3.5.0.sh
@@ -0,0 +1,4 @@
+apt-get update && apt-get install -y wget
+wget https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.tar.gz -O maven.tar.gz
+mkdir /usr/local/apache-maven/ && tar xvf maven.tar.gz -C /usr/local/apache-maven/
+mv /usr/local/apache-maven/apache-maven-3.5.0 /usr/local/apache-maven/apache-maven
diff --git a/docker/readme.md b/docker/readme.md
index f8f03427..c5805162 100644
--- a/docker/readme.md
+++ b/docker/readme.md
@@ -10,30 +10,22 @@ Each docker image contains a `/workspace` where all relevant files are located.
When building the image, a lombok.jar will be downloaded to `/workspace`. By default, this is the latest released version. You
can download a specific version by adding `--build-arg lombokjar=lombok-<major.minor.build>.jar`
+### `ARG jdk=1.9`
-### Use fresh lombok.jar
-If you want to use a lombok.jar from your system, assuming `<lombokhome>` contains the path to the lombok directory (where the .git subdirectory is located)
-you can mount your recently built lombok.jar by providing `-v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar` to the `docker run` command.
-
+The jdk version to be used. Supported values:
-## Example build commands:
+- `1.9` (default)
+- `1.8`
-```
-docker build -t lombok-gradle-jdk9 -f gradle/Dockerfile .
+The version is also accessible in `JDK_VERSION`.
-docker build -t lombok-gradle-jdk9 --build-arg lombokjar=lombok-1.16.18.jar -f gradle/Dockerfile .
-```
-## Example run commands:
-
-```
-docker run -it lombok-gradle-jdk9
+### Use fresh lombok.jar
+If you want to use a lombok.jar from your system, assuming `<lombokhome>` contains the path to the lombok directory (where the .git subdirectory is located)
+you can mount your recently built lombok.jar by providing `-v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar` to the `docker run` command.
-docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar lombok-gradle-jdk9
-```
-## Example container commands:
+## Examples
-```
-gradle assemble
-```
+- [gradle](gradle/readme.md)
+- [maven](maven/readme.md)