|
36 | 36 | # Update base image |
37 | 37 | ARG UBUNTU_VERSION=22.04 |
38 | 38 | FROM ubuntu:${UBUNTU_VERSION} as build |
39 | | -RUN apt update && apt upgrade -y |
40 | | -RUN apt autoremove -y |
| 39 | + |
| 40 | +# Consolidated system update/upgrade and autoremove |
| 41 | +RUN apt-get update && \ |
| 42 | + apt-get upgrade -y && \ |
| 43 | + apt-get autoremove -y && \ |
| 44 | + rm -rf /var/lib/apt/lists/* |
41 | 45 |
|
42 | 46 | # Install Bazel deps |
43 | | -RUN apt install -y software-properties-common |
44 | | -RUN add-apt-repository ppa:openjdk-r/ppa |
45 | | -RUN apt install -y \ |
46 | | - build-essential \ |
47 | | - openjdk-21-jdk \ |
48 | | - python3 \ |
49 | | - curl \ |
50 | | - zip \ |
51 | | - unzip |
| 47 | +RUN apt-get update && \ |
| 48 | + apt-get install -y --no-install-recommends \ |
| 49 | + software-properties-common \ |
| 50 | + build-essential \ |
| 51 | + openjdk-21-jdk \ |
| 52 | + python3 \ |
| 53 | + curl \ |
| 54 | + zip \ |
| 55 | + unzip && \ |
| 56 | + add-apt-repository ppa:openjdk-r/ppa && \ |
| 57 | + rm -rf /var/lib/apt/lists/* |
| 58 | + |
| 59 | +# Set working directory for Bazel build |
| 60 | +WORKDIR /root/bazel |
52 | 61 |
|
53 | 62 | # Download Bazel source |
54 | 63 | ARG BAZEL_VERSION=7.7.1 |
55 | | -RUN cd ~ && mkdir bazel && cd bazel |
56 | | -RUN curl -LO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip |
57 | | -RUN unzip -q bazel-${BAZEL_VERSION}-dist.zip |
| 64 | +RUN curl -LO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip && \ |
| 65 | + unzip -q bazel-${BAZEL_VERSION}-dist.zip |
58 | 66 |
|
59 | | -# Build Bazel |
60 | | -# NOTE: This step is flaky and frequently hangs for multiarch / buildx. |
61 | | -# If it takes more than 2 hours, restart the Docker build and try again. |
| 67 | +## Build Bazel, copy the binary, then install ProxyWasm build deps |
| 68 | +# NOTE: This step is flaky and may hang for multiarch/buildx. |
| 69 | +# If it takes more than 2 hours, restart the Docker build. |
62 | 70 | ENV EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" |
63 | | -RUN bash ./compile.sh |
64 | | - |
65 | | -# Copy output to /usr/bin |
66 | | -RUN cp /output/bazel /usr/bin/bazel |
67 | | - |
68 | | -# Install ProxyWasm build deps |
69 | | -RUN apt install -y \ |
70 | | - git \ |
71 | | - python3-distutils \ |
72 | | - clang \ |
73 | | - libstdc++6 \ |
74 | | - libssl-dev \ |
75 | | - libz-dev |
| 71 | +RUN bash ./compile.sh && \ |
| 72 | + cp /output/bazel /usr/bin/bazel && \ |
| 73 | + apt-get update && \ |
| 74 | + apt-get install -y --no-install-recommends \ |
| 75 | + git \ |
| 76 | + python3-distutils \ |
| 77 | + clang \ |
| 78 | + libstdc++6 \ |
| 79 | + libssl-dev \ |
| 80 | + libz-dev && \ |
| 81 | + rm -rf /var/lib/apt/lists/* |
0 commit comments