There was a git repository compiled with ./compile.sh, so I borrowed and excerpted a part for reference dockerfile.
bazel-build
FROM python:3.8-alpine3.11
ARG bazel_ver=3.1.0
ENV JAVA_HOME=/usr/lib/jvm/default-jvm \
PATH="$JAVA_HOME/bin:${PATH}" \
BAZEL_VERSION=3.1.0
RUN apk add --virtual .bazel_build --no-cache g++ gcc \
bash zip unzip cmake make linux-headers openjdk8 && \
wget -q "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip" \
-O bazel.zip && \
mkdir "bazel-${BAZEL_VERSION}" && \
unzip -qd "bazel-${BAZEL_VERSION}" bazel.zip && \
rm bazel.zip && \
cd "bazel-${BAZEL_VERSION}" && \
sed -i -e 's/-classpath/-J-Xmx6096m -J-Xms128m -classpath/g' \
scripts/bootstrap/compile.sh && \
EXTRA_BAZEL_ARGS=--host_javabase=@local_jdk//:jdk ./compile.sh && \
cp -p output/bazel /usr/bin/ && \
cd ../ && rm -rf "bazel-${BAZEL_VERSION}" && \
bazel version && \
apk del --purge .bazel_build
All you have to do is docker build
and push
When compiling from source, openjdk8 is not supported because it does not support openjdk11.
The part replaced with sed
specifies the size of Java heap memory. If not specified, the memory may be exhausted and the memory may drop on the way.
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
Recommended Posts