aboutsummaryrefslogtreecommitdiff
path: root/docker/bazel/Dockerfile
blob: 06149b1e212c0eb38a042757795691de3e21f0d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM ubuntu:18.04 as downloader

ARG jdk=16
ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh
RUN provision/jdk/java-${jdk}.sh

ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} /lombok.jar

ARG bazel=2.0.0
ADD provision/bazel/bazel-${bazel}.sh provision/bazel/bazel-${bazel}.sh
RUN provision/bazel/bazel-${bazel}.sh

FROM ubuntu:18.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/ ./

COPY --from=downloader /lombok.jar /workspace/classpath/lombok.jar
COPY --from=downloader /lombok.jar /workspace/modules/lombok.jar

ARG jdk=16
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