blob: 036f9de70cd1b49ae6571f326e95de274cf21d58 [file] [log] [blame]
# ATTENTION: use the build.sh script to build this image.
# ./build.sh <OCI_REPOSITORY> <BAZEL_VERSION>
FROM ubuntu:20.04 AS base_image
RUN --mount=source=bazel/oci/install_packages.sh,target=/mnt/install_packages.sh,type=bind \
/mnt/install_packages.sh
FROM base_image AS downloader
ARG TARGETARCH BAZEL_VERSION
WORKDIR /var/bazel
RUN --mount=source=bazel/oci/install_bazel.sh,target=/mnt/install_bazel.sh,type=bind \
/mnt/install_bazel.sh
FROM base_image
RUN useradd --system --create-home --home-dir=/home/ubuntu --shell=/bin/bash --gid=root --groups=sudo --uid=1000 ubuntu
USER ubuntu
WORKDIR /home/ubuntu
COPY --from=downloader /var/bazel/bazel /usr/local/bin/bazel
ENTRYPOINT ["/usr/local/bin/bazel"]