Skip to content

Commit 94a540e

Browse files
committed
Consolidate system update and package installation in Dockerfile
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 11279bf commit 94a540e

File tree

3 files changed

+36
-32
lines changed

3 files changed

+36
-32
lines changed

bazel/cargo/wasmsign/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ crates_vendor(
2727
name = "crates_vendor",
2828
cargo_lockfile = ":Cargo.Bazel.lock",
2929
generate_binaries = True,
30-
generate_target_compatible_with = False,
3130
manifests = [":Cargo.toml"],
3231
mode = "remote",
3332
repository_name = "cu", # shorten generated paths for Windows...

bazel/cargo/wasmtime/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ exports_files(
2626
crates_vendor(
2727
name = "crates_vendor",
2828
cargo_lockfile = ":Cargo.Bazel.lock",
29-
generate_target_compatible_with = False,
3029
manifests = [":Cargo.toml"],
3130
mode = "remote",
3231
repository_name = "cu", # shorten generated paths for Windows...

bazel/external/Dockerfile.bazel

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,42 +34,48 @@
3434
# -- //test/...
3535

3636
# Update base image
37-
ARG UBUNTU_VERSION=22.04
38-
FROM ubuntu:${UBUNTU_VERSION} as build
39-
RUN apt update && apt upgrade -y
40-
RUN apt autoremove -y
37+
ARG UBUNTU_VERSION=24.04
38+
FROM ubuntu:${UBUNTU_VERSION} AS build
4139

42-
# 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 \
40+
# Use bash for all RUN instructions
41+
SHELL ["/bin/bash", "-c"]
42+
43+
# Consolidated system update/upgrade and autoremove
44+
RUN apt-get update && \
45+
apt-get upgrade -y && \
46+
apt-get autoremove -y && \
47+
rm -rf /var/lib/apt/lists/*
48+
49+
## All build dependencies for Bazel and ProxyWasm are listed in DEPS for clarity and maintainability.
50+
ARG DEPS="\
4651
build-essential \
52+
clang \
53+
curl \
54+
git \
55+
libssl-dev \
56+
libstdc++6 \
57+
libz-dev \
4758
openjdk-21-jdk \
4859
python3 \
49-
curl \
50-
zip \
51-
unzip
60+
unzip \
61+
zip\
62+
"
63+
# Install all build dependencies (no PPA needed on Ubuntu 24.04)
64+
RUN apt-get update && \
65+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $DEPS && \
66+
rm -rf /var/lib/apt/lists/*
67+
68+
# Set working directory for Bazel build
69+
WORKDIR /root/bazel
5270

5371
# Download Bazel source
5472
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
73+
RUN curl -LO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip && \
74+
unzip -q bazel-${BAZEL_VERSION}-dist.zip
5875

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.
76+
## Build Bazel and copy the binary
77+
# NOTE: This step is flaky and may hang for multiarch/buildx.
78+
# If it takes more than 2 hours, restart the Docker build.
6279
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
80+
RUN ./compile.sh && \
81+
cp /output/bazel /usr/bin/bazel

0 commit comments

Comments
 (0)