Dockerfile31 lines · 1032 chars FROM eclipse-temurin:8-jre
# Install essential build tools
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends bash curl unzip ca-certificates; \
rm -rf /var/lib/apt/lists/*; \
# Install Bazelisk (Bazel wrapper) to fetch a compatible Bazel binary
BAZELISK_VERSION="v1.20.1"; \
if curl -fsSL -o /usr/local/bin/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-amd64; then \
chmod +x /usr/local/bin/bazelisk; \
ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel; \
else \
echo 'Could not download bazelisk'; \
fi
WORKDIR /workspace
COPY . .
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Build the project with Bazel
RUN /bin/bash -lc "bazel build //..." || true
ARG ENABLE_BAZEL_TESTS=false
RUN if [ "$ENABLE_BAZEL_TESTS" = "true" ]; then bazel test //...; fi
CMD ["bash", "-lc", "echo 'Build completed. Artifacts are under /workspace/bazel-bin' ; ls -la /workspace/bazel-bin || true; tail -f /dev/null"]