Repository navigation
feat(core): Add support for building and running on musllinux_1_2; Add musllinux_1_2 dependency container images. #1054
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 4 commits
06c7147
e4adcf6
889f97d
4998cd6
9b14097
4edace6
fb47ca2
55dc329
6be8932
1112b85
3c06cbf
56d3b92
bedf84e
7b29331
d34b315
c2c4a31
5eea5f1
987104c
8d2ed5d
873b9dc
33d85e5
2980a94
6d9286b
d3a7817
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| FROM quay.io/pypa/musllinux_1_2_aarch64 | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
|
|
||
| WORKDIR /root | ||
|
|
||
| RUN mkdir -p ./tools/scripts/lib_install | ||
| COPY ./tools/scripts/lib_install ./tools/scripts/lib_install | ||
|
|
||
| RUN ./tools/scripts/lib_install/musllinux_1_2/install-all.sh | ||
|
|
||
| # Remove cached files | ||
| RUN apk cache clean && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* | ||
|
|
||
|
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. 🧹 Nitpick (assertive) Leverage 🤖 Prompt for AI Agents
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. added --no-cache to install-prebuilt-packages.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. 🧩 Analysis chain@jackluo923 Great! I can see that # This can be removed since --no-cache prevents cache creation
RUN apk cache clean && rm -rf /var/cache/apk/* /tmp/* /var/tmp/*You can remove that RUN command entirely, which will result in:
The same optimization can be applied to the x86_64 variant as well. 🏁 Script executed: Length of output: 131 @jackluo923 I can see from the script output that the To properly implement the
This change should be applied to both the aarch64 and x86_64 variants for consistency. 🏁 Script executed: Length of output: 940 @jackluo923 I can see the current state of the 1. In apk update && apk add \To: apk add --no-cache \2. In the Dockerfile, remove line 10-11: # Remove cached files
RUN apk cache clean && rm -rf /var/cache/apk/* /tmp/* /var/tmp/*This optimization works because:
Don't forget to apply the same changes to the x86_64 variant for consistency! 🧠 Learnings usedIf you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
||
| # NOTE: Don't flatten the image or else we'll lose any environment modifications from the base | ||
| # image. | ||
|
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. 🧹 Nitpick (assertive) Consider adding a non-root user and a HEALTHCHECK for defence-in-depth 🧰 Tools🪛 Checkov (3.2.334)[LOW] 1-1: Ensure the base image uses a non latest version tag (CKV_DOCKER_7) [LOW] 1-14: Ensure that HEALTHCHECK instructions have been added to container images (CKV_DOCKER_2) [LOW] 1-14: Ensure that a user for the container has been created (CKV_DOCKER_3) 🪛 Hadolint (2.12.0)[warning] 1-1: Always tag the version of an image explicitly (DL3006) 🤖 Prompt for AI Agents
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. NA
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. @jackluo923 Understood, I'll note that these security suggestions are not applicable for this Dockerfile. Moving on. 🧠 Learnings used
jackluo923 marked this conversation as resolved.
Resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
| set -o pipefail | ||
|
|
||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
| script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
| component_root="${script_dir}/../../../" | ||
|
|
||
| build_cmd=( | ||
| docker buildx build | ||
| --platform linux/arm64 | ||
| --tag clp-core-dependencies-aarch64-musllinux_1_2:dev | ||
| "$component_root" | ||
| --file "${script_dir}/Dockerfile" | ||
| --load | ||
| ) | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| if command -v git >/dev/null && git -C "$script_dir" rev-parse --is-inside-work-tree >/dev/null ; | ||
| then | ||
| build_cmd+=( | ||
| --label "org.opencontainers.image.revision=$(git -C "$script_dir" rev-parse HEAD)" | ||
| --label "org.opencontainers.image.source=$(git -C "$script_dir" remote get-url origin)" | ||
| ) | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| echo "Running: ${build_cmd[*]}" | ||
| "${build_cmd[@]}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| FROM quay.io/pypa/musllinux_1_2_x86_64 | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
|
|
||
| WORKDIR /root | ||
|
|
||
| RUN mkdir -p ./tools/scripts/lib_install | ||
| COPY ./tools/scripts/lib_install ./tools/scripts/lib_install | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
|
|
||
| RUN ./tools/scripts/lib_install/musllinux_1_2/install-all.sh | ||
|
|
||
| # Remove cached files | ||
| RUN apk cache clean && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
|
|
||
| # NOTE: Don't flatten the image or else we'll lose any environment modifications from the base | ||
| # image. | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
| set -o pipefail | ||
|
|
||
| script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
| component_root="${script_dir}/../../../" | ||
|
|
||
| build_cmd=( | ||
| docker buildx build | ||
| --platform linux/amd64 | ||
| --tag clp-core-dependencies-x86-musllinux_1_2:dev | ||
| "$component_root" | ||
| --file "${script_dir}/Dockerfile" | ||
| --load | ||
| ) | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| if command -v git >/dev/null && git -C "$script_dir" rev-parse --is-inside-work-tree >/dev/null ; | ||
| then | ||
| build_cmd+=( | ||
| --label "org.opencontainers.image.revision=$(git -C "$script_dir" rev-parse HEAD)" | ||
| --label "org.opencontainers.image.source=$(git -C "$script_dir" remote get-url origin)" | ||
| ) | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| echo "Running: ${build_cmd[*]}" | ||
| "${build_cmd[@]}" | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
| set -o pipefail | ||
|
|
||
| script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
|
|
||
| "${script_dir}/install-prebuilt-packages.sh" | ||
| "${script_dir}/install-packages-from-source.sh" | ||
|
|
||
| # TODO: https://github.com/y-scope/clp/issues/795 | ||
| "${script_dir}/../check-cmake-version.sh" | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
| set -o pipefail | ||
|
|
||
| script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
| lib_install_scripts_dir="${script_dir}/.." | ||
|
|
||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
| # NOTE: The remaining installation scripts depend on boost, so we install it beforehand. | ||
| "${lib_install_scripts_dir}/install-boost.sh" 1.87.0 | ||
|
|
||
| # NOTE: | ||
| # 1. libarchive may statically link with LZMA, LZ4, and Zstandard, so we install them beforehand. | ||
| # 2. The versions of libarchive, LZMA, LZ4, and Zstandard available in manylinux_2_28's package | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
| # repositories are either dated or don't include static libraries, so we install more recent | ||
| # versions from source. | ||
| "${lib_install_scripts_dir}/liblzma.sh" 5.8.1 | ||
| "${lib_install_scripts_dir}/lz4.sh" 1.10.0 | ||
| "${lib_install_scripts_dir}/zstandard.sh" 1.5.7 | ||
| "${lib_install_scripts_dir}/libarchive.sh" 3.8.0 | ||
|
|
||
| "${lib_install_scripts_dir}/msgpack.sh" 7.0.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
| set -o pipefail | ||
|
|
||
| apk update && apk add \ | ||
| openjdk11-jdk \ | ||
| jq \ | ||
| curl-dev \ | ||
| bzip2-dev \ | ||
| bzip2-static \ | ||
| mariadb-connector-c-dev \ | ||
| openssl-dev \ | ||
| zlib-dev \ | ||
| zlib-static | ||
|
jackluo923 marked this conversation as resolved.
Resolved
jackluo923 marked this conversation as resolved.
Resolved
jackluo923 marked this conversation as resolved.
Resolved
|
||
|
|
||
| # Install `task` | ||
| # NOTE: We lock `task` to a version < 3.43 to avoid https://github.com/y-scope/clp/issues/ | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
| VERSION=3.42.1 | ||
| ARCH=$(uname -m) | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
| case "$ARCH" in | ||
| x86_64) ARCH=amd64 ;; | ||
| aarch64) ARCH=arm64 ;; | ||
| *) echo "Unsupported architecture: $ARCH"; exit 1 ;; | ||
| esac | ||
|
|
||
| wget -O /tmp/task.tar.gz \ | ||
| "https://github.com/go-task/task/releases/download/v${VERSION}/task_linux_${ARCH}.tar.gz" | ||
|
|
||
| tar -C /usr/local/bin -xzf /tmp/task.tar.gz task | ||
| chmod +x /usr/local/bin/task | ||
| rm /tmp/task.tar.gz | ||
|
jackluo923 marked this conversation as resolved.
Resolved
jackluo923 marked this conversation as resolved.
Resolved
|
||
|
|
||
| # Downgrade to CMake v3 to work around https://github.com/y-scope/clp/issues/795 | ||
| pipx uninstall cmake | ||
| pipx install cmake~=3.31 | ||
|
jackluo923 marked this conversation as resolved.
Resolved
|
||
|
jackluo923 marked this conversation as resolved.
Resolved
|
Uh oh!
There was an error while loading. Please reload this page.