diff options
Diffstat (limited to 'docker')
-rw-r--r-- | docker/.dockerignore | 1 | ||||
-rw-r--r-- | docker/ant/Dockerfile | 33 | ||||
-rw-r--r-- | docker/ant/files/jdk-8/build.xml | 25 | ||||
-rw-r--r-- | docker/ant/files/jdk-9/build.xml | 35 | ||||
-rw-r--r-- | docker/ant/readme.md | 33 | ||||
-rw-r--r-- | docker/gradle/Dockerfile | 31 | ||||
-rw-r--r-- | docker/gradle/files/build.gradle | 5 | ||||
-rw-r--r-- | docker/gradle/readme.md | 33 | ||||
-rw-r--r-- | docker/maven/Dockerfile | 34 | ||||
-rw-r--r-- | docker/maven/files/jdk-8/pom.xml | 44 | ||||
-rw-r--r-- | docker/maven/files/jdk-9/pom.xml | 53 | ||||
-rw-r--r-- | docker/maven/readme.md | 33 | ||||
-rwxr-xr-x | docker/provision/ant/ant-1.10.1.sh | 4 | ||||
-rwxr-xr-x | docker/provision/gradle/gradle-4.2.1.sh | 4 | ||||
-rwxr-xr-x | docker/provision/jdk/java-10.sh | 4 | ||||
-rwxr-xr-x | docker/provision/jdk/java-8.sh | 6 | ||||
-rwxr-xr-x | docker/provision/jdk/java-9.sh | 4 | ||||
-rwxr-xr-x | docker/provision/maven/maven-3.5.0.sh | 4 | ||||
-rw-r--r-- | docker/readme.md | 31 | ||||
-rw-r--r-- | docker/shared/lombok.config | 4 | ||||
-rw-r--r-- | docker/shared/src/main/java/HelloWorld.java | 13 |
21 files changed, 434 insertions, 0 deletions
diff --git a/docker/.dockerignore b/docker/.dockerignore new file mode 100644 index 00000000..0d79d56d --- /dev/null +++ b/docker/.dockerignore @@ -0,0 +1 @@ +readme.txt
\ No newline at end of file diff --git a/docker/ant/Dockerfile b/docker/ant/Dockerfile new file mode 100644 index 00000000..32457709 --- /dev/null +++ b/docker/ant/Dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:16.04 as downloader + +ARG jdk=9 +ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh +RUN provision/jdk/java-${jdk}.sh + +ARG ant=1.10.1 +ADD provision/ant/ant-${ant}.sh provision/ant/ant-${ant}.sh +RUN provision/ant/ant-${ant}.sh + +FROM ubuntu:16.04 + +COPY --from=downloader /usr/local/apache-ant/ /usr/local/apache-ant/ +COPY --from=downloader /opt/jdk/ /opt/jdk/ + +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 + +ADD shared/ ./ + +ARG jdk=9 +ADD ant/files/jdk-${jdk} ./ + +ARG lombokjar=lombok.jar +ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar + +ENV JDK_VERSION=${jdk} +ENV JAVA_HOME=/opt/jdk +ENV ANT_HOME=/usr/local/apache-ant/apache-ant +ENV PATH="${JAVA_HOME}/bin:${ANT_HOME}/bin:${PATH}" + +ENTRYPOINT bash diff --git a/docker/ant/files/jdk-8/build.xml b/docker/ant/files/jdk-8/build.xml new file mode 100644 index 00000000..2fc38879 --- /dev/null +++ b/docker/ant/files/jdk-8/build.xml @@ -0,0 +1,25 @@ +<project name="example" default="dist" basedir="."> + <property name="src" location="src/main/java"/> + <property name="build" location="build"/> + <property name="dist" location="dist"/> + <property name="build.sysclasspath" value="ignore"/> + + <target name="init"> + <tstamp/> + <mkdir dir="${build}"/> + </target> + + <target name="compile" depends="init" description="compile the source"> + <javac classpath="lombok.jar" srcdir="${src}" destdir="${build}" fork="true"/> + </target> + + <target name="dist" depends="compile" description="generate the distribution"> + <mkdir dir="${dist}/lib"/> + <jar jarfile="${dist}/lib/example-${DSTAMP}.jar" basedir="${build}"/> + </target> + + <target name="clean" description="clean up"> + <delete dir="${build}"/> + <delete dir="${dist}"/> + </target> +</project>
\ No newline at end of file diff --git a/docker/ant/files/jdk-9/build.xml b/docker/ant/files/jdk-9/build.xml new file mode 100644 index 00000000..3f181ed9 --- /dev/null +++ b/docker/ant/files/jdk-9/build.xml @@ -0,0 +1,35 @@ +<project name="example" default="dist" basedir="."> + <property name="src" location="src/main/java"/> + <property name="build" location="build"/> + <property name="dist" location="dist"/> + <property name="build.sysclasspath" value="ignore"/> + + <target name="init"> + <tstamp/> + <mkdir dir="${build}"/> + </target> + + <target name="compile" depends="init" description="compile the source"> + <javac classpath="lombok.jar" srcdir="${src}" destdir="${build}" fork="true"> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"/> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED"/> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"/> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"/> + <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/> + </javac> + </target> + + <target name="dist" depends="compile" description="generate the distribution"> + <mkdir dir="${dist}/lib"/> + <jar jarfile="${dist}/lib/example-${DSTAMP}.jar" basedir="${build}"/> + </target> + + <target name="clean" description="clean up"> + <delete dir="${build}"/> + <delete dir="${dist}"/> + </target> +</project>
\ No newline at end of file diff --git a/docker/ant/readme.md b/docker/ant/readme.md new file mode 100644 index 00000000..d6462523 --- /dev/null +++ b/docker/ant/readme.md @@ -0,0 +1,33 @@ +## Configuration + +[_(general configuration and options)_](../readme.md) + +### `ARG ant=1.10.1` + +The ant version to be used. Supported values: + +- `1.10.1` (default) + +## Example build commands: + +(To be executed from the `<lombokhome>/docker` directory) + +``` +docker build -t lombok-ant-jdk9 -f gradle/Dockerfile . + +docker build -t lombok-ant-jdk9 --build-arg lombokjar=lombok-1.16.18.jar -f gradle/Dockerfile . +``` + +## Example run commands: + +``` +docker run -it lombok-ant-jdk9 + +docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar lombok-ant-jdk9 +``` + +## Example container commands: + +``` +ant dist +``` diff --git a/docker/gradle/Dockerfile b/docker/gradle/Dockerfile new file mode 100644 index 00000000..938d417e --- /dev/null +++ b/docker/gradle/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:16.04 as downloader
+
+ARG jdk=9
+ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh
+RUN provision/jdk/java-${jdk}.sh
+
+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/ /opt/jdk/
+
+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
+
+ADD shared/ ./
+ADD gradle/files/ ./
+ARG lombokjar=lombok.jar
+ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar
+
+ARG jdk=9
+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/files/build.gradle b/docker/gradle/files/build.gradle new file mode 100644 index 00000000..49923f04 --- /dev/null +++ b/docker/gradle/files/build.gradle @@ -0,0 +1,5 @@ +apply plugin: 'java'
+
+dependencies {
+ compileOnly files('lombok.jar')
+}
\ No newline at end of file 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 new file mode 100644 index 00000000..83f124f1 --- /dev/null +++ b/docker/maven/Dockerfile @@ -0,0 +1,34 @@ +FROM ubuntu:16.04 as downloader
+
+ARG jdk=9
+ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh
+RUN provision/jdk/java-${jdk}.sh
+
+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/ /opt/jdk/
+
+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
+
+ADD shared/ ./
+
+ARG jdk=9
+ADD maven/files/jdk-${jdk} ./
+
+ARG lombokjar=lombok.jar
+ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar
+
+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}"
+
+ENTRYPOINT bash
diff --git a/docker/maven/files/jdk-8/pom.xml b/docker/maven/files/jdk-8/pom.xml new file mode 100644 index 00000000..87c4a6a8 --- /dev/null +++ b/docker/maven/files/jdk-8/pom.xml @@ -0,0 +1,44 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.example</groupId> + <artifactId>lombok-jdk-${env.JDK_VERSION}</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <java.version>1.8</java.version> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> + <fork>true</fork> + <compilerargs> + <arg>-Werror</arg> + <arg>-Xlint:all</arg> + </compilerargs> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.2.3</version> + <scope>system</scope> + <systemPath>/workspace/lombok.jar</systemPath> + </dependency> + </dependencies> + +</project>
\ No newline at end of file diff --git a/docker/maven/files/jdk-9/pom.xml b/docker/maven/files/jdk-9/pom.xml new file mode 100644 index 00000000..dfbb9ad9 --- /dev/null +++ b/docker/maven/files/jdk-9/pom.xml @@ -0,0 +1,53 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.example</groupId> + <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> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> + <fork>true</fork> + <compilerargs> + <arg>-Werror</arg> + <arg>-Xlint:all</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> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.2.3</version> + <scope>system</scope> + <systemPath>/workspace/lombok.jar</systemPath> + </dependency> + </dependencies> + +</project>
\ No newline at end of file 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/ant/ant-1.10.1.sh b/docker/provision/ant/ant-1.10.1.sh new file mode 100755 index 00000000..3de7f3d0 --- /dev/null +++ b/docker/provision/ant/ant-1.10.1.sh @@ -0,0 +1,4 @@ +apt-get update && apt-get install -y wget +wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.1-bin.tar.gz -O ant.tar.gz +mkdir /usr/local/apache-ant/ && tar xvf ant.tar.gz -C /usr/local/apache-ant/ +mv /usr/local/apache-ant/apache-ant-1.10.1 /usr/local/apache-ant/apache-ant diff --git a/docker/provision/gradle/gradle-4.2.1.sh b/docker/provision/gradle/gradle-4.2.1.sh new file mode 100755 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-10.sh b/docker/provision/jdk/java-10.sh new file mode 100755 index 00000000..9b5f3176 --- /dev/null +++ b/docker/provision/jdk/java-10.sh @@ -0,0 +1,4 @@ +apt-get update && apt-get install -y wget +wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/10+46/76eac37278c24557a3c4199677f19b62/jdk-10_linux-x64_bin.tar.gz -O jdk.tar.gz +tar -xzf jdk.tar.gz -C /opt/ +mv /opt/jdk-10 /opt/jdk diff --git a/docker/provision/jdk/java-8.sh b/docker/provision/jdk/java-8.sh new file mode 100755 index 00000000..44795c6c --- /dev/null +++ b/docker/provision/jdk/java-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-9.sh b/docker/provision/jdk/java-9.sh new file mode 100755 index 00000000..fd488dc8 --- /dev/null +++ b/docker/provision/jdk/java-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.4+11/c2514751926b4512b076cc82f959763f/jdk-9.0.4_linux-x64_bin.tar.gz -O jdk.tar.gz +tar -xzf jdk.tar.gz -C /opt/ +mv /opt/jdk-9.0.4 /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 100755 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 new file mode 100644 index 00000000..f6b6e550 --- /dev/null +++ b/docker/readme.md @@ -0,0 +1,31 @@ +## Configuration
+
+### `/workspace`
+
+Each docker image contains a `/workspace` where all relevant files are located.
+
+
+### `ARG lombokjar=lombok.jar`
+
+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=9`
+
+The jdk version to be used. Supported values:
+
+- `9` (default)
+- `8`
+
+The version is also accessible in `JDK_VERSION`.
+
+
+### 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.
+
+
+## Examples
+
+- [gradle](gradle/readme.md)
+- [maven](maven/readme.md)
diff --git a/docker/shared/lombok.config b/docker/shared/lombok.config new file mode 100644 index 00000000..62f16b08 --- /dev/null +++ b/docker/shared/lombok.config @@ -0,0 +1,4 @@ +lombok.addJavaxGeneratedAnnotation = false
+lombok.anyConstructor.suppressConstructorProperties = true
+
+config.stopBubbling = true
\ No newline at end of file diff --git a/docker/shared/src/main/java/HelloWorld.java b/docker/shared/src/main/java/HelloWorld.java new file mode 100644 index 00000000..f4c30218 --- /dev/null +++ b/docker/shared/src/main/java/HelloWorld.java @@ -0,0 +1,13 @@ +@lombok.Data
+public class HelloWorld {
+ private final int answer;
+
+ public static void main(String... args) {
+ System.out.println(new HelloWorld(42).getAnswer());
+ }
+
+ @FunctionalInterface
+ interface Foo {
+ String name();
+ }
+}
|