diff options
Diffstat (limited to 'docker/bazel')
-rw-r--r-- | docker/bazel/Dockerfile | 32 | ||||
-rw-r--r-- | docker/bazel/files/BUILD | 18 | ||||
-rw-r--r-- | docker/bazel/files/WORKSPACE | 4 | ||||
-rw-r--r-- | docker/bazel/readme.md | 33 |
4 files changed, 87 insertions, 0 deletions
diff --git a/docker/bazel/Dockerfile b/docker/bazel/Dockerfile new file mode 100644 index 00000000..bbfc4e89 --- /dev/null +++ b/docker/bazel/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:16.04 as downloader + +ARG jdk=10 +ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh +RUN provision/jdk/java-${jdk}.sh + +ARG bazel=0.13.0 +ADD provision/bazel/bazel-${bazel}.sh provision/bazel/bazel-${bazel}.sh +RUN provision/bazel/bazel-${bazel}.sh + +FROM ubuntu:16.04 + +COPY --from=downloader /opt/bazel/ /opt/bazel/ +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 +RUN apt-get update && apt-get install -y g++ + +WORKDIR workspace + +ADD shared/ ./ +ADD bazel/files/ ./ +ARG lombokjar=lombok.jar +ADD https://projectlombok.org/downloads/${lombokjar} lombok.jar + +ARG jdk=10 +ENV JDK_VERSION=${jdk} +ENV JAVA_HOME=/opt/jdk +ENV BAZEL_HOME=/opt/bazel +ENV PATH="${JAVA_HOME}/bin:${BAZEL_HOME}/bin:${PATH}" + +ENTRYPOINT bash diff --git a/docker/bazel/files/BUILD b/docker/bazel/files/BUILD new file mode 100644 index 00000000..b01da26d --- /dev/null +++ b/docker/bazel/files/BUILD @@ -0,0 +1,18 @@ +java_binary( + name = "ProjectRunner", + main_class = "HelloWorld", + srcs = glob(["src/main/java/*.java"]), + deps = [":lombok"], +) + +java_plugin( + name = "lombok_plugin", + processor_class = "lombok.launch.AnnotationProcessorHider$AnnotationProcessor", + deps = ["@lombok_jar//jar"], +) + +java_library( + name = "lombok", + exports = ["@lombok_jar//jar"], + exported_plugins = [":lombok_plugin"], +)
\ No newline at end of file diff --git a/docker/bazel/files/WORKSPACE b/docker/bazel/files/WORKSPACE new file mode 100644 index 00000000..265cfc4b --- /dev/null +++ b/docker/bazel/files/WORKSPACE @@ -0,0 +1,4 @@ +http_jar( + name = "lombok_jar", + url = "https://projectlombok.org/lombok-edge.jar", +)
\ No newline at end of file diff --git a/docker/bazel/readme.md b/docker/bazel/readme.md new file mode 100644 index 00000000..2bed86f1 --- /dev/null +++ b/docker/bazel/readme.md @@ -0,0 +1,33 @@ +## Configuration + +[_(general configuration and options)_](../readme.md) + +### `ARG bazel=0.13.0` + +The bazel version to be used. Supported values: + +- `0.13.0` (default) + +## Example build commands: + +(To be executed from the `<lombokhome>/docker` directory) + +``` +docker build -t lombok-bazel-jdk10 -f bazel/Dockerfile . + +docker build -t lombok-bazel-jdk10 --build-arg lombokjar=lombok-1.16.20.jar -f bazel/Dockerfile . +``` + +## Example run commands: + +``` +docker run -it lombok-bazel-jdk10 + +docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar lombok-bazel-jdk10 +``` + +## Example container commands: + +``` +bazel build //:ProjectRunner +``` |