add ant Dockerfile, use jdk major version numbers instead

This commit is contained in:
Roel Spilker committed 2017-11-28 23:37:34 +01:00
1 parent 192ce9bc16
commit 1f7b8c3d2c
12 files changed
+237 -61

No files matched your search

+33
View File
@@ -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
+25
View File
@@ -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>
+35
View File
@@ -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>
+33
View File
@@ -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
```
+2 -2
View File
@@ -1,6 +1,6 @@
FROM ubuntu:16.04 as downloader
ARG jdk=1.9
ARG jdk=9
ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh
RUN provision/jdk/java-${jdk}.sh
@@ -22,7 +22,7 @@ ADD gradle/files/ ./
ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar
ARG jdk
ARG jdk=9
ENV JDK_VERSION=${jdk}
ENV JAVA_HOME=/opt/jdk
ENV GRADLE_HOME=/opt/gradle/gradle
+6 -4
View File
@@ -1,7 +1,7 @@
FROM ubuntu:16.04 as downloader
ARG jdk=1.9
ADD provision/jdk/ provision/jdk/
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
@@ -18,11 +18,13 @@ RUN update-alternatives --install /usr/bin/java java /opt/jdk/bin/java 1000 &&
WORKDIR workspace
ADD shared/ ./
ADD maven/files/ ./
ARG jdk=9
ADD maven/files/jdk-${jdk} ./
ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar
ARG jdk
ENV JDK_VERSION=${jdk}
ENV JAVA_HOME=/opt/jdk
ENV M2_HOME=/usr/local/apache-maven/apache-maven
+44
View File
@@ -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>
@@ -1,53 +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>${env.JDK_VERSION}</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 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>
+4
View File
@@ -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
File renamed without changes.
File renamed without changes.
+3 -3
View File
@@ -10,12 +10,12 @@ 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`
### `ARG jdk=9`
The jdk version to be used. Supported values:
- `1.9` (default)
- `1.8`
- `9` (default)
- `8`
The version is also accessible in `JDK_VERSION`.