|
| 1 | +# syntax=docker/dockerfile:1 |
| 2 | + |
| 3 | +# Prep: |
| 4 | +# docker run --rm --privileged tonistiigi/binfmt --install all |
| 5 | +# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
| 6 | +# Need to see "F" flag: cat /proc/sys/fs/binfmt_misc/qemu-* |
| 7 | +# |
| 8 | +# Build: |
| 9 | +# docker buildx build --platform linux/s390x -t $IMAGE -f Dockerfile.bazel |
| 10 | +# |
| 11 | +# Push: |
| 12 | +# docker image tag $IMAGE ghcr.io/proxy-wasm/$IMAGE |
| 13 | +# docker push ghcr.io/proxy-wasm/$IMAGE |
| 14 | +# |
| 15 | +# Test: |
| 16 | +# docker run --rm --volume $(pwd):/mnt --workdir /mnt \ |
| 17 | +# --platform linux/s390x $IMAGE \ |
| 18 | +# bazel test --verbose_failures --test_output=errors \ |
| 19 | +# --define engine=null --config=clang --test_timeout=1800 \ |
| 20 | +# -- //test/... |
| 21 | + |
| 22 | +# Update base image |
| 23 | +ARG UBUNTU_VERSION=20.04 |
| 24 | +FROM ubuntu:${UBUNTU_VERSION} as build |
| 25 | +RUN apt update && apt upgrade -y |
| 26 | +RUN apt autoremove -y |
| 27 | + |
| 28 | +# Install Bazel deps |
| 29 | +RUN apt install -y software-properties-common |
| 30 | +RUN add-apt-repository ppa:openjdk-r/ppa |
| 31 | +RUN apt install -y \ |
| 32 | + build-essential \ |
| 33 | + openjdk-11-jdk \ |
| 34 | + python3 \ |
| 35 | + curl \ |
| 36 | + zip \ |
| 37 | + unzip |
| 38 | + |
| 39 | +# Download Bazel source |
| 40 | +ARG BAZEL_VERSION=6.5.0 |
| 41 | +RUN cd ~ && mkdir bazel && cd bazel |
| 42 | +RUN curl -LO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip |
| 43 | +RUN unzip -q bazel-${BAZEL_VERSION}-dist.zip |
| 44 | + |
| 45 | +# Build Bazel |
| 46 | +# NOTE: This step is flaky and frequently hangs for multiarch / buildx. |
| 47 | +# If it takes more than 2 hours, restart the Docker build and try again. |
| 48 | +ENV EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" |
| 49 | +RUN bash ./compile.sh |
| 50 | + |
| 51 | +# Copy output to /usr/bin |
| 52 | +RUN cp /output/bazel /usr/bin/bazel |
| 53 | + |
| 54 | +# Install ProxyWasm build deps |
| 55 | +RUN apt install -y \ |
| 56 | + git \ |
| 57 | + python3-distutils \ |
| 58 | + clang \ |
| 59 | + libstdc++6 |
0 commit comments