-
Notifications
You must be signed in to change notification settings - Fork 10
chore(ci): optimize size/usage of pre-built CI images #1414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
eb653cf
64968d8
ea91ad7
142b9f1
a694ddf
136a97b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,54 @@ | ||
| # Builder stage: compile bloaty from source. Its build-only deps (cmake, ninja-build, g++) stay here. | ||
| FROM registry.ddbuild.io/docker:24.0.4-jammy AS bloaty-builder | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive \ | ||
| TZ=Etc/UTC | ||
|
|
||
| RUN apt-get update && \ | ||
| apt-get install -y --no-install-recommends ca-certificates curl cmake ninja-build g++ bzip2 && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY .ci/install-bloaty.sh /install-bloaty.sh | ||
| RUN chmod +x /install-bloaty.sh && /install-bloaty.sh | ||
|
|
||
| # Final stage: runtime-only dependencies. Build toolchain is not present here. | ||
| FROM registry.ddbuild.io/docker:24.0.4-jammy | ||
|
|
||
| ARG RUST_VERSION=1.93.0 | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive \ | ||
| TZ=Etc/UTC | ||
|
|
||
| RUN --mount=type=bind,source=.ci/configure-apt-mirror.sh,target=/tmp/configure-apt-mirror.sh \ | ||
| sh /tmp/configure-apt-mirror.sh | ||
|
|
||
| # Install basic utilities and an updated compiler/binutils toolchain, which is necessary for compiling. | ||
| # Runtime utilities for the benchmark/binary-size-analysis jobs. python3 + binutils are needed by | ||
| # analyze-binary-size.py (objcopy / strip). No C/C++ toolchain here — bloaty is built in the | ||
| # dedicated builder stage above and copied in below. | ||
| RUN apt-get update && \ | ||
| apt-get install -y --no-install-recommends curl ca-certificates awscli lsb-release git jq bc bzip2 && \ | ||
| apt-get clean | ||
| apt-get install -y --no-install-recommends curl ca-certificates lsb-release git jq bc bzip2 python3 binutils && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN apt-get update && \ | ||
| dd-package --bucket binaries-ddbuild-io-prod --package devtools/dd-package-dev --distribution "20.04" | ||
| dd-package --bucket binaries-ddbuild-io-prod --package devtools/dd-package-dev --distribution "20.04" && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install pr-commenter which we will need to post comments to Github. | ||
| COPY .ci/images/smp/install-pr-commenter.sh / | ||
| # Install Rust which is required by the Binary Size Analysis job. | ||
| RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain ${RUST_VERSION} | ||
| ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
|
||
| # Install pr-commenter for posting analysis reports back to GitHub. | ||
| COPY .ci/install-pr-commenter.sh / | ||
| RUN chmod +x /install-pr-commenter.sh && /install-pr-commenter.sh | ||
|
|
||
| # Build and install bloaty for binary size analysis. | ||
| COPY .ci/images/smp/install-bloaty.sh / | ||
| RUN chmod +x /install-bloaty.sh && /install-bloaty.sh | ||
| # Install AWS CLI for retrieiving credentials and settings for the SMP image registry location. | ||
| COPY .ci/install-awscli.sh / | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is true, but we only run the jobs in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although saying that makes me realize... we still technically build the SMP CI image for |
||
| RUN chmod +x /install-awscli.sh && /install-awscli.sh | ||
|
|
||
| # Copy just the compiled bloaty binary from the builder stage. | ||
| COPY --from=bloaty-builder /usr/local/bin/bloaty /usr/local/bin/bloaty | ||
|
|
||
| COPY .ci/images/smp/entrypoint.sh / | ||
| RUN chmod +x /entrypoint.sh | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.