├── .gitignore ├── .github └── workflows │ ├── destroy-runner.yaml │ ├── create-runner.yaml │ └── paketo-arm64.yml ├── scripts ├── mod-bptoml.sh ├── mod-pkgtoml.sh ├── build.sh ├── clone.sh ├── reset.sh └── create-builder.sh ├── arm64-toml ├── syft.toml ├── watchexec.toml ├── rust-dist.toml ├── cargo.toml ├── rustup.toml └── bellsoft.toml ├── stack └── Dockerfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .envrc 3 | buildpacks/ 4 | builder.toml.out 5 | target 6 | -------------------------------------------------------------------------------- /.github/workflows/destroy-runner.yaml: -------------------------------------------------------------------------------- 1 | name: destroy-oci-arm64-runner 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | destroy-oci-arm64-runner: 8 | runs-on: ubuntu-latest 9 | env: 10 | TF_WORKSPACE: paketo-arm64 11 | TF_CLOUD_ORGANIZATION: dashaun 12 | steps: 13 | 14 | - name: Checkout dynamic-tf-oci-arm64 15 | uses: actions/checkout@v2 16 | with: 17 | repository: dashaun/dynamic-tf-oci-arm64-runner 18 | ref: main -------------------------------------------------------------------------------- /scripts/mod-bptoml.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | BPTOML="$1" 5 | 6 | if [ -z "$BPTOML" ]; then 7 | echo "" 8 | echo "USAGE:" 9 | echo " update.sh " 10 | echo "" 11 | echo "Enter the path to buildpack.toml." 12 | echo "The script will update buildpack.toml and change the id to end with '-arm64'." 13 | echo "" 14 | exit 255 15 | fi 16 | 17 | if ! [ -f "$BPTOML" ]; then 18 | echo "[$BPTOML] does not exist" 19 | exit 254 20 | fi 21 | 22 | NEW=$(yj -t < "$BPTOML" | jq -r '.buildpack.id |= . + "-arm64"' | yj -jti) 23 | echo "$NEW" > "$BPTOML" 24 | -------------------------------------------------------------------------------- /scripts/mod-pkgtoml.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | PKGTOML="$1" 5 | 6 | if [ -z "$PKGTOML" ]; then 7 | echo "" 8 | echo "USAGE:" 9 | echo " mod-pkgtoml.sh " 10 | echo "" 11 | echo "Enter the path to package.toml." 12 | echo "The script will update package.toml and change the id to end with '-arm64'." 13 | echo "" 14 | exit 255 15 | fi 16 | 17 | if ! [ -f "$PKGTOML" ]; then 18 | echo "[$PKGTOML] does not exist" 19 | exit 254 20 | fi 21 | 22 | NEW=$(yj -t < "$PKGTOML" | jq -r '.dependencies[].uri |= sub("(?^.*):(?.*)$"; .bp + "-arm64:" + .ver)' | yj -jti) 23 | echo "$NEW" > "$PKGTOML" 24 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | BPID="$1" 5 | WORK="./buildpacks" 6 | 7 | if [ -z "$BPID" ]; then 8 | echo "" 9 | echo "USAGE:" 10 | echo " build.sh " 11 | echo "" 12 | echo "Enter the buildpack id for a composite buildpack." 13 | echo "The script will build the composite and all component buildpacks." 14 | echo "This requires a directory setup in advance, like what you get from running 'clone.sh'." 15 | echo "" 16 | exit 255 17 | fi 18 | 19 | if [ -z "$WORK" ] && ! [ -d "$WORK" ]; then 20 | echo "WORK cannot be empty and must exist" 21 | exit 254 22 | fi 23 | 24 | for GROUP in $(yj -t < "$WORK/$BPID/buildpack.toml" | jq -rc '.order[].group[]'); do 25 | BUILDPACK=$(echo "$GROUP" | jq -r ".id") 26 | VERSION=$(echo "$GROUP" | jq -r ".version") 27 | pushd "$WORK/$BUILDPACK" >/dev/null 28 | create-package --destination ./out --version "$VERSION" 29 | pushd ./out >/dev/null 30 | sudo --preserve-env=PATH pack buildpack package "$BUILDPACK-arm64:$VERSION" 31 | popd 32 | popd 33 | done 34 | -------------------------------------------------------------------------------- /.github/workflows/create-runner.yaml: -------------------------------------------------------------------------------- 1 | name: create-oci-arm64-runner 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | create-oci-arm64-runner: 8 | runs-on: ubuntu-latest 9 | env: 10 | TF_WORKSPACE: paketo-arm64 11 | TF_CLOUD_ORGANIZATION: dashaun 12 | steps: 13 | 14 | - name: Checkout dynamic-tf-oci-arm64 15 | uses: actions/checkout@v2 16 | with: 17 | repository: dashaun/dynamic-tf-oci-arm64-runner 18 | ref: main 19 | 20 | - name: Setup Terraform 21 | uses: hashicorp/setup-terraform@v2.0.2 22 | with: 23 | cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} 24 | 25 | - name: terraform init 26 | run: terraform init -upgrade 27 | 28 | - name: terraform validate 29 | id: validate 30 | run: terraform validate -no-color 31 | 32 | - name: terraform plan 33 | id: plan 34 | run: terraform plan -no-color 35 | 36 | - name: terraform apply 37 | id: apply 38 | run: terraform apply -auto-approve -------------------------------------------------------------------------------- /scripts/clone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | BPID="$1" 5 | BPVER="$2" 6 | WORK="./buildpacks" 7 | 8 | if [ -z "$BPID" ] || [ -z "$BPVER" ]; then 9 | echo "" 10 | echo "USAGE:" 11 | echo " clone.sh " 12 | echo "" 13 | echo "Enter the buildpack id/version for a composite buildpack." 14 | echo "The script will clone the composite and all component buildpacks." 15 | echo "" 16 | exit 255 17 | fi 18 | 19 | if [ -z "$WORK" ]; then 20 | echo "WORK cannot be empty" 21 | exit 254 22 | fi 23 | 24 | mkdir -p "$WORK" 25 | rm -rf "${WORK:?}/"* 26 | 27 | git clone "https://github.com/$BPID" "$WORK/$BPID" 28 | pushd "$WORK/$BPID" >/dev/null 29 | git -c "advice.detachedHead=false" checkout "v$BPVER" 30 | popd 31 | 32 | for GROUP in $(yj -t < "$WORK/$BPID/buildpack.toml" | jq -rc '.order[].group[]'); do 33 | BUILDPACK=$(echo "$GROUP" | jq -r ".id") 34 | VERSION=$(echo "$GROUP" | jq -r ".version") 35 | git clone "https://github.com/$BUILDPACK" "$WORK/$BUILDPACK" 36 | pushd "$WORK/$BUILDPACK" >/dev/null 37 | git -c "advice.detachedHead=false" checkout "v$VERSION" 38 | popd 39 | done 40 | 41 | -------------------------------------------------------------------------------- /scripts/reset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | BPID="$1" 5 | BPVER="$2" 6 | WORK="./buildpacks" 7 | 8 | if [ -z "$BPID" ] || [ -z "$BPVER" ]; then 9 | echo "" 10 | echo "USAGE:" 11 | echo " reset.sh " 12 | echo "" 13 | echo "Enter the buildpack id/version for a composite buildpack." 14 | echo "The script will reset and clear out any changes." 15 | echo "It can also be used to update, if the composite buildpack has been updated." 16 | echo "This requires a directory setup in advance, like what you get from running 'clone.sh'." 17 | echo "" 18 | exit 255 19 | fi 20 | 21 | if [ -z "$WORK" ] && ! [ -d "$WORK" ]; then 22 | echo "WORK cannot be empty and must exist" 23 | exit 254 24 | fi 25 | 26 | pushd "$WORK/$BPID" >/dev/null 27 | git reset --hard HEAD 28 | git checkout main 29 | git pull 30 | git -c "advice.detachedHead=false" checkout "v$BPVER" 31 | popd 32 | 33 | for GROUP in $(yj -t < "$WORK/$BPID/buildpack.toml" | jq -rc '.order[].group[]'); do 34 | BUILDPACK=$(echo "$GROUP" | jq -r ".id") 35 | VERSION=$(echo "$GROUP" | jq -r ".version") 36 | pushd "$WORK/$BUILDPACK" >/dev/null 37 | git reset --hard HEAD 38 | git checkout main 39 | git pull 40 | git -c "advice.detachedHead=false" checkout "v$VERSION" 41 | popd 42 | done 43 | 44 | -------------------------------------------------------------------------------- /arm64-toml/syft.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 the original author or authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | api = "0.7" 16 | 17 | [buildpack] 18 | description = "A Cloud Native Buildpack that contributes the Syft CLI which can be used to generate SBoM information" 19 | homepage = "https://github.com/paketo-buildpacks/syft" 20 | id = "paketo-buildpacks/syft-arm64" 21 | keywords = ["bom", "sbom", "bill of materials", "syft"] 22 | name = "Paketo Buildpack for Syft" 23 | sbom-formats = ["application/vnd.cyclonedx+json", "application/vnd.syft+json"] 24 | version = "{{.version}}" 25 | 26 | [[buildpack.licenses]] 27 | type = "Apache-2.0" 28 | uri = "https://github.com/paketo-buildpacks/syft/blob/main/LICENSE" 29 | 30 | [metadata] 31 | include-files = ["LICENSE", "NOTICE", "README.md", "bin/build", "bin/detect", "bin/main", "buildpack.toml"] 32 | pre-package = "scripts/build.sh" 33 | 34 | [[metadata.dependencies]] 35 | cpes = ["cpe:2.3:a:anchore:syft:0.60.1:*:*:*:*:*:*:*"] 36 | id = "syft" 37 | name = "Syft" 38 | purl = "pkg:generic/anchore-syft@0.60.1" 39 | sha256 = "" 40 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 41 | uri = "https://github.com/anchore/syft/releases/download/v0.60.1/syft_0.60.1_linux_arm64.tar.gz" 42 | version = "0.60.1" 43 | 44 | [[metadata.dependencies.licenses]] 45 | type = "Apache-2.0" 46 | uri = "https://github.com/anchore/syft/blob/main/LICENSE" 47 | 48 | [[stacks]] 49 | id = "io.buildpacks.stacks.bionic" 50 | 51 | [[stacks]] 52 | id = "io.paketo.stacks.tiny" 53 | 54 | [[stacks]] 55 | id = "*" -------------------------------------------------------------------------------- /arm64-toml/watchexec.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 the original author or authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | api = "0.7" 16 | 17 | [buildpack] 18 | description = "A Cloud Native Buildpack that provides the Watchexec binary tool" 19 | homepage = "https://github.com/paketo-buildpacks/watchexec" 20 | id = "paketo-buildpacks/watchexec-arm64" 21 | keywords = ["watchexec", "reloadable", "processes"] 22 | name = "Paketo Buildpack for Watchexec" 23 | sbom-formats = ["application/vnd.syft+json", "application/vnd.cyclonedx+json"] 24 | version = "{{.version}}" 25 | 26 | [[buildpack.licenses]] 27 | type = "Apache-2.0" 28 | uri = "https://github.com/paketo-buildpacks/watchexec/blob/main/LICENSE" 29 | 30 | [metadata] 31 | include-files = ["LICENSE", "NOTICE", "README.md", "bin/build", "bin/detect", "bin/main", "buildpack.toml"] 32 | pre-package = "scripts/build.sh" 33 | 34 | [[metadata.dependencies]] 35 | cpes = ["cpe:2.3:a:watchexec:watchexec:1.20.5:*:*:*:*:*:*:*"] 36 | id = "watchexec" 37 | name = "Watchexec" 38 | purl = "pkg:generic/watchexec@1.20.5?arch=arm64" 39 | sha256 = "" 40 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 41 | uri = "https://github.com/watchexec/watchexec/releases/download/cli-v1.20.5/watchexec-1.20.5-aarch64-unknown-linux-gnu.tar.xz" 42 | version = "1.20.5" 43 | 44 | [[metadata.dependencies.licenses]] 45 | type = "Apache-2.0" 46 | uri = "https://github.com/watchexec/watchexec/blob/main/LICENSE" 47 | 48 | [[stacks]] 49 | id = "io.buildpacks.stacks.bionic" 50 | 51 | [[stacks]] 52 | id = "io.paketo.stacks.tiny" 53 | 54 | [[stacks]] 55 | id = "*" -------------------------------------------------------------------------------- /arm64-toml/rust-dist.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 the original author or authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | api = "0.7" 16 | 17 | [buildpack] 18 | description = "A Cloud Native Buildpack that provides the Rust language build tools." 19 | homepage = "https://github.com/paketo-community/rust-dist" 20 | id = "paketo-community/rust-dist-arm64" 21 | keywords = ["rust", "rustc", "cargo", "tools"] 22 | name = "Rust Distribution Buildpack" 23 | sbom-formats = ["application/vnd.cyclonedx+json", "application/vnd.syft+json"] 24 | version = "{{.version}}" 25 | 26 | [[buildpack.licenses]] 27 | type = "Apache-2.0" 28 | uri = "https://github.com/paketo-community/rust-dist/blob/main/LICENSE" 29 | 30 | [metadata] 31 | include-files = ["LICENSE", "NOTICE", "README.md", "bin/build", "bin/detect", "bin/main", "buildpack.toml"] 32 | pre-package = "scripts/build.sh" 33 | 34 | [[metadata.configurations]] 35 | build = true 36 | default = "1.*" 37 | description = "the Rust version" 38 | name = "BP_RUST_VERSION" 39 | 40 | [[metadata.dependencies]] 41 | cpes = ["cpe:2.3:a:rust:rust:1.65.0:*:*:*:*:*:*:*"] 42 | id = "rust" 43 | name = "Rust" 44 | purl = "pkg:generic/rust@1.65.0" 45 | sha256 = "ab25be4d2c3ad580dea968fba84f190b773adc993380cb65dd2a5d64d22614ea" 46 | source = "https://static.rust-lang.org/dist/rustc-1.64.0-src.tar.gz" 47 | source_sha256 = "b3cd9f481e1a2901bf6f3808d30c69cc4ea80d93c4cc4e2ed52258b180381205" 48 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 49 | uri = "https://deps.paketo.io/rust/rust_1.65.0_linux_noarch_bionic_ab25be4d.tgz" 50 | version = "1.65.0" 51 | 52 | [[metadata.dependencies.licenses]] 53 | type = "Apache-2.0" 54 | uri = "https://github.com/rust-lang/rust/blob/master/LICENSE-APACHE" 55 | 56 | [[metadata.dependencies.licenses]] 57 | type = "MIT" 58 | uri = "https://github.com/rust-lang/rust/blob/master/LICENSE-MIT" 59 | 60 | [[stacks]] 61 | id = "io.buildpacks.stacks.bionic" 62 | 63 | [[stacks]] 64 | id = "io.paketo.stacks.tiny" 65 | 66 | [[stacks]] 67 | id = "*" -------------------------------------------------------------------------------- /scripts/create-builder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | BPID="$1" 5 | BPVER="$2" 6 | LFCVER="$3" 7 | RUNIMG="$4" 8 | BLDIMG="$5" 9 | STACKID="$6" 10 | BLDRIMG="$7" 11 | WORK="./buildpacks" 12 | 13 | if [ -z "$BPID" ] || [ -z "$BPVER" ] || [ -z "$RUNIMG" ] || [ -z "$BLDIMG" ] || [ -z "$STACKID" ] || [ -z "$BLDRIMG" ]; then 14 | echo "" 15 | echo "USAGE:" 16 | echo " create-builder.sh " 17 | echo "" 18 | echo "Enter the required info in order:" 19 | echo " - buildpack id" 20 | echo " - buildpack version" 21 | echo " - a lifecycle version" 22 | echo " - run image" 23 | echo " - build image" 24 | echo " - stack id" 25 | echo " - builder image" 26 | echo "" 27 | echo "The script will create a builder.toml from the composite buildpack." 28 | echo "This may not be 100% accurate, but should be close." 29 | echo "" 30 | exit 255 31 | fi 32 | 33 | if [ -z "$WORK" ] && ! [ -d "$WORK" ]; then 34 | echo "WORK cannot be empty and must exist" 35 | exit 254 36 | fi 37 | 38 | BPTOML="$WORK/$BPID/buildpack.toml" 39 | 40 | if ! [ -f "$BPTOML" ]; then 41 | echo "Cannot find [$BPTOML]" 42 | exit 253 43 | fi 44 | 45 | BLDRTOML="$WORK/builder/builder.toml" 46 | mkdir -p "$(dirname $BLDRTOML)" 47 | 48 | desc() { 49 | echo "description = \"An ARM64 builder based on $BPID\"" 50 | echo "" 51 | } 52 | 53 | buildpacks() { 54 | for GROUP in $(yj -t < "$WORK/$BPID/buildpack.toml" | jq -rc '.order[].group[]'); do 55 | BUILDPACK=$(echo "$GROUP" | jq -r ".id") 56 | VERSION=$(echo "$GROUP" | jq -r ".version") 57 | echo "[[buildpacks]]" 58 | echo " id = \"$BUILDPACK-arm64\"" 59 | echo " version = \"$VERSION\"" 60 | echo " uri = \"docker://docker.io/$BUILDPACK-arm64:$VERSION\"" 61 | echo "" 62 | done 63 | } 64 | 65 | lifecycle() { 66 | cat << EOF 67 | [lifecycle] 68 | uri = "https://github.com/buildpacks/lifecycle/releases/download/v${LFCVER}/lifecycle-v${LFCVER}+linux.arm64.tgz" 69 | 70 | EOF 71 | } 72 | 73 | order() { 74 | yj -t < "$BPTOML" | jq -r '{"order": .order} | .order[].group[].id |= . + "-arm64"' | yj -jti 75 | echo "" 76 | } 77 | 78 | stack() { 79 | cat << EOF 80 | [stack] 81 | build-image = "$BLDIMG" 82 | id = "$STACKID" 83 | run-image = "$RUNIMG" 84 | 85 | EOF 86 | } 87 | 88 | { desc; buildpacks; lifecycle; order; stack; } > "$BLDRTOML" 89 | 90 | # use pull-policy never so that we alway use the local docker image that we just built 91 | # without this, it may pull down different docker images and use them instead 92 | sudo pack builder create "$BLDRIMG" -c "$BLDRTOML" --pull-policy never -------------------------------------------------------------------------------- /stack/Dockerfile: -------------------------------------------------------------------------------- 1 | ## For the Base image (both build & run) 2 | FROM ubuntu:focal as base 3 | 4 | ARG STACK_ID 5 | 6 | ENV CNB_USER_ID=1000 7 | ENV CNB_GROUP_ID=1000 8 | ENV CNB_STACK_ID=${STACK_ID} 9 | LABEL io.buildpacks.stack.id=${STACK_ID} 10 | 11 | RUN groupadd cnb --gid ${CNB_GROUP_ID} && \ 12 | useradd --uid ${CNB_USER_ID} --gid ${CNB_GROUP_ID} -m -s /bin/bash cnb 13 | 14 | ## For the Run Image 15 | 16 | FROM base as run 17 | 18 | ARG PKG_ARGS='--allow-downgrades --allow-remove-essential --allow-change-held-packages --no-install-recommends' 19 | 20 | # This comes from here: https://github.com/paketo-buildpacks/stacks/blob/main/bionic/dockerfile/run/Dockerfile and 21 | # the packages from here: https://github.com/paketo-buildpacks/stacks/blob/main/packages/base/run 22 | # which is what's used in paketobuildpacks/base:build image 23 | RUN echo "debconf debconf/frontend select noninteractive" | debconf-set-selections && \ 24 | export DEBIAN_FRONTEND=noninteractive && \ 25 | apt-get -y ${PKG_ARGS} update && \ 26 | apt-get -y ${PKG_ARGS} upgrade && \ 27 | apt-get -y ${PKG_ARGS} install locales && \ 28 | locale-gen en_US.UTF-8 && \ 29 | update-locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 && \ 30 | apt-get install -y ca-certificates libssl1.1 libyaml-0-2 netbase openssl tzdata zlib1g && \ 31 | find /usr/share/doc/*/* ! -name copyright | xargs rm -rf && \ 32 | rm -rf \ 33 | /usr/share/man/* /usr/share/info/* \ 34 | /usr/share/groff/* /usr/share/lintian/* /usr/share/linda/* \ 35 | /var/lib/apt/lists/* /tmp/* 36 | 37 | USER ${CNB_USER_ID}:${CNB_GROUP_ID} 38 | 39 | # For the Build Image 40 | 41 | FROM base as build 42 | 43 | # This comes from here: https://github.com/paketo-buildpacks/stacks/blob/main/bionic/dockerfile/build/Dockerfile and 44 | # the packages from here: https://github.com/paketo-buildpacks/stacks/blob/main/packages/base/build 45 | # which is what's used in paketobuildpacks/base:build image 46 | RUN echo "debconf debconf/frontend select noninteractive" | debconf-set-selections && \ 47 | export DEBIAN_FRONTEND=noninteractive && \ 48 | apt-get -y ${PKG_ARGS} update && \ 49 | apt-get -y ${PKG_ARGS} upgrade && \ 50 | apt-get -y ${PKG_ARGS} install locales && \ 51 | locale-gen en_US.UTF-8 && \ 52 | update-locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 && \ 53 | apt-get -y ${PKG_ARGS} install build-essential ca-certificates curl git jq libgmp-dev libssl1.1 libyaml-0-2 netbase openssl tzdata xz-utils zlib1g-dev && \ 54 | rm -rf /var/lib/apt/lists/* /tmp/* 55 | 56 | RUN curl -sL -o /usr/local/bin/yj https://github.com/sclevine/yj/releases/latest/download/yj-linux \ 57 | && chmod +x /usr/local/bin/yj 58 | 59 | USER ${CNB_USER_ID}:${CNB_GROUP_ID} 60 | -------------------------------------------------------------------------------- /arm64-toml/cargo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 the original author or authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | api = "0.7" 16 | 17 | [buildpack] 18 | description = "A Cloud Native Buildpack that builds Cargo-based Rust applications from source" 19 | homepage = "https://github.com/paketo-community/cargo" 20 | id = "paketo-community/cargo-arm64" 21 | keywords = ["cargo", "rust", "build-system"] 22 | name = "Rust Cargo Build Pack" 23 | sbom-formats = ["application/vnd.cyclonedx+json", "application/vnd.syft+json"] 24 | version = "{{.version}}" 25 | 26 | [[buildpack.licenses]] 27 | type = "Apache-2.0" 28 | uri = "https://github.com/paketo-community/cargo/blob/main/LICENSE" 29 | 30 | [metadata] 31 | include-files = ["LICENSE", "NOTICE", "README.md", "bin/build", "bin/detect", "bin/main", "buildpack.toml"] 32 | pre-package = "scripts/build.sh" 33 | 34 | [[metadata.configurations]] 35 | build = true 36 | default = "" 37 | description = "additional tools to be add with Cargo install" 38 | name = "BP_CARGO_INSTALL_TOOLS" 39 | 40 | [[metadata.configurations]] 41 | build = true 42 | default = "" 43 | description = "additional arguments to pass to Cargo install for tools" 44 | name = "BP_CARGO_INSTALL_TOOLS_ARGS" 45 | 46 | [[metadata.configurations]] 47 | build = true 48 | default = "--locked" 49 | description = "additional arguments to pass to Cargo install" 50 | name = "BP_CARGO_INSTALL_ARGS" 51 | 52 | [[metadata.configurations]] 53 | build = true 54 | default = "" 55 | description = "the subset of workspace members for Cargo to install" 56 | name = "BP_CARGO_WORKSPACE_MEMBERS" 57 | 58 | [[metadata.configurations]] 59 | build = true 60 | default = "static/*:templates/*:public/*:html/*" 61 | description = "colon separated list of glob patterns, matched source files are included" 62 | name = "BP_INCLUDE_FILES" 63 | 64 | [[metadata.configurations]] 65 | build = true 66 | default = "" 67 | description = "colon separated list of glob patterns, matched source files are removed" 68 | name = "BP_EXCLUDE_FILES" 69 | 70 | [[metadata.configurations]] 71 | build = true 72 | default = "false" 73 | description = "Skip installing tini" 74 | name = "BP_CARGO_TINI_DISABLED" 75 | 76 | [[metadata.configurations]] 77 | build = true 78 | default = "false" 79 | description = "Skip running SBOM scan" 80 | name = "BP_DISABLE_SBOM" 81 | 82 | [[metadata.dependencies]] 83 | cpes = ["cpe:2.3:a:tini_project:tini:0.19.0:*:*:*:*:*:*:*"] 84 | id = "tini" 85 | name = "Tini" 86 | purl = "pkg:generic/tini@v0.19.0" 87 | sha256 = "07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81" 88 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 89 | uri = "https://github.com/krallin/tini/releases/download/v0.19.0/tini-arm64" 90 | version = "0.19.0" 91 | 92 | [[metadata.dependencies.licenses]] 93 | type = "MIT" 94 | uri = "https://github.com/krallin/tini/blob/master/LICENSE" 95 | 96 | [[stacks]] 97 | id = "io.buildpacks.stacks.bionic" 98 | 99 | [[stacks]] 100 | id = "io.paketo.stacks.tiny" 101 | 102 | [[stacks]] 103 | id = "*" -------------------------------------------------------------------------------- /arm64-toml/rustup.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 the original author or authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | api = "0.7" 16 | 17 | [buildpack] 18 | description = "A Cloud Native Buildpack that installs and executes `rustup` to install Rust" 19 | homepage = "https://github.com/paketo-community/rustup" 20 | id = "paketo-community/rustup-arm64" 21 | keywords = ["rust", "rustup"] 22 | name = "Paketo Rustup Buildpack" 23 | sbom-formats = ["application/vnd.cyclonedx+json", "application/vnd.syft+json"] 24 | version = "{{.version}}" 25 | 26 | [[buildpack.licenses]] 27 | type = "Apache-2.0" 28 | uri = "https://github.com/paketo-community/rustup/blob/main/LICENSE" 29 | 30 | [metadata] 31 | include-files = ["LICENSE", "NOTICE", "README.md", "bin/build", "bin/detect", "bin/main", "buildpack.toml"] 32 | pre-package = "scripts/build.sh" 33 | 34 | [[metadata.configurations]] 35 | build = true 36 | default = "stable" 37 | description = "the Rust toolchain or version number to install" 38 | name = "BP_RUST_TOOLCHAIN" 39 | 40 | [[metadata.configurations]] 41 | build = true 42 | default = "minimal" 43 | description = "the Rust profile to install" 44 | name = "BP_RUST_PROFILE" 45 | 46 | [[metadata.configurations]] 47 | build = true 48 | default = "" 49 | description = "an additional Rust target to install" 50 | name = "BP_RUST_TARGET" 51 | 52 | [[metadata.configurations]] 53 | build = true 54 | default = "true" 55 | description = "use rustup to install Rust" 56 | name = "BP_RUSTUP_ENABLED" 57 | 58 | [[metadata.configurations]] 59 | build = true 60 | default = "1" 61 | description = "the rustup version" 62 | name = "BP_RUSTUP_INIT_VERSION" 63 | 64 | [[metadata.configurations]] 65 | build = true 66 | default = "gnu" 67 | description = "libc implementation: gnu or musl" 68 | name = "BP_RUSTUP_INIT_LIBC" 69 | 70 | [[metadata.dependencies]] 71 | cpes = ["cpe:2.3:a:rust:rustup:1.25.1:*:*:*:*:*:*:*"] 72 | id = "rustup-init-gnu" 73 | name = "Rustup (GNU libc)" 74 | purl = "pkg:generic/rustup@1.25.1" 75 | sha256 = "" 76 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 77 | uri = "https://static.rust-lang.org/rustup/archive/1.25.1/aarch64-unknown-linux-gnu/rustup-init" 78 | version = "1.25.1" 79 | 80 | [[metadata.dependencies.licenses]] 81 | type = "Apache-2.0" 82 | uri = "https://github.com/rust-lang/rustup/blob/master/LICENSE-APACHE" 83 | 84 | [[metadata.dependencies.licenses]] 85 | type = "MIT" 86 | uri = "https://github.com/rust-lang/rustup/blob/master/LICENSE-MIT" 87 | 88 | [[metadata.dependencies]] 89 | cpes = ["cpe:2.3:a:rust:rustup:1.25.1:*:*:*:*:*:*:*"] 90 | id = "rustup-init-musl" 91 | name = "Rustup (musl libc)" 92 | purl = "pkg:generic/rustup@1.25.1" 93 | sha256 = "" 94 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 95 | uri = "https://static.rust-lang.org/rustup/archive/1.25.1/aarch64-unknown-linux-musl/rustup-init" 96 | version = "1.25.1" 97 | 98 | [[metadata.dependencies.licenses]] 99 | type = "Apache-2.0" 100 | uri = "https://github.com/rust-lang/rustup/blob/master/LICENSE-APACHE" 101 | 102 | [[metadata.dependencies.licenses]] 103 | type = "MIT" 104 | uri = "https://github.com/rust-lang/rustup/blob/master/LICENSE-MIT" 105 | 106 | [[stacks]] 107 | id = "io.buildpacks.stacks.bionic" 108 | 109 | [[stacks]] 110 | id = "io.paketo.stacks.tiny" 111 | 112 | [[stacks]] 113 | id = "*" -------------------------------------------------------------------------------- /.github/workflows/paketo-arm64.yml: -------------------------------------------------------------------------------- 1 | name: arm64-buildpack 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ARM64 13 | 14 | steps: 15 | - name: setup go 16 | uses: actions/setup-go@v3 17 | with: 18 | go-version: '>=1.17.0' 19 | 20 | - name: Checkout 21 | uses: actions/checkout@v2 22 | 23 | - name: Login to DockerHub 24 | uses: docker/login-action@v2 25 | with: 26 | username: ${{ secrets.DOCKERHUB_USERNAME }} 27 | password: ${{ secrets.DOCKERHUB_TOKEN }} 28 | 29 | - name: Run Image 30 | run: | 31 | docker build ./stack -t dashaun/stack-run:focal --target run --build-arg STACK_ID="io.dashaun.stack.focal.arm64" 32 | docker push dashaun/stack-run:focal 33 | 34 | - name: Build Image 35 | run: | 36 | docker build ./stack -t dashaun/stack-build:focal --target build --build-arg STACK_ID="io.dashaun.stack.focal.arm64" 37 | docker push dashaun/stack-build:focal 38 | 39 | - name: install deps 40 | run: | 41 | go install github.com/sclevine/yj/v5@v5.1.0 42 | go install github.com/paketo-buildpacks/libpak/cmd/create-package@v1.60.1 43 | 44 | - name: Downlad pack-arm64 45 | uses: dsaltares/fetch-gh-release-asset@master 46 | with: 47 | repo: 'buildpacks/pack' 48 | version: 'tags/v0.27.0' 49 | file: 'pack-v0.27.0-linux-arm64.tgz' 50 | 51 | - name: Install pack 52 | run: | 53 | tar -xvzf pack-v0.27.0-linux-arm64.tgz 54 | sudo install pack /usr/local/bin 55 | 56 | - name: java-buildpack 57 | run: | 58 | ./scripts/clone.sh paketo-buildpacks/java 7.10.0 59 | sed -i "s/paketo-buildpacks\/java\"/dashaun\/java-builder\"/g" ./buildpacks/paketo-buildpacks/java/buildpack.toml 60 | find ./buildpacks -name "buildpack.toml" | xargs -n 1 ./scripts/mod-bptoml.sh 61 | find ./buildpacks -name "package.toml" | xargs -n 1 ./scripts/mod-pkgtoml.sh 62 | cp ./arm64-toml/bellsoft.toml buildpacks/paketo-buildpacks/bellsoft-liberica/buildpack.toml 63 | cp ./arm64-toml/syft.toml buildpacks/paketo-buildpacks/syft/buildpack.toml 64 | cp ./arm64-toml/watchexec.toml buildpacks/paketo-buildpacks/watchexec/buildpack.toml 65 | ./scripts/build.sh paketo-buildpacks/java 66 | ./scripts/create-builder.sh paketo-buildpacks/java 7.10.0 0.15.0 dashaun/stack-run:focal dashaun/stack-build:focal io.dashaun.stack.focal.arm64 dashaun/builder:focal 67 | docker tag dashaun/builder:focal docker.io/dashaun/java-builder-arm64:7.10.0 68 | docker tag dashaun/builder:focal docker.io/dashaun/java-builder-arm64:latest 69 | docker push docker.io/dashaun/java-builder-arm64:7.10.0 70 | docker push docker.io/dashaun/java-builder-arm64:latest 71 | 72 | - name: java-native-image-buildpack 73 | run: | 74 | ./scripts/clone.sh paketo-buildpacks/java-native-image 7.37.0 75 | sed -i "s/paketo-buildpacks\/java-native-image/dashaun\/java-native-image/g" ./buildpacks/paketo-buildpacks/java-native-image/buildpack.toml 76 | find ./buildpacks -name "buildpack.toml" | xargs -n 1 ./scripts/mod-bptoml.sh 77 | find ./buildpacks -name "package.toml" | xargs -n 1 ./scripts/mod-pkgtoml.sh 78 | cp ./arm64-toml/bellsoft.toml buildpacks/paketo-buildpacks/bellsoft-liberica/buildpack.toml 79 | cp ./arm64-toml/syft.toml buildpacks/paketo-buildpacks/syft/buildpack.toml 80 | ./scripts/build.sh paketo-buildpacks/java-native-image 81 | ./scripts/create-builder.sh paketo-buildpacks/java-native-image 7.37.0 0.15.0 dashaun/stack-run:focal dashaun/stack-build:focal io.dashaun.stack.focal.arm64 dashaun/native-builder:focal 82 | docker tag dashaun/native-builder:focal docker.io/dashaun/java-native-builder-arm64:7.37.0 83 | docker tag dashaun/native-builder:focal docker.io/dashaun/native-builder:focal-arm64 84 | docker tag dashaun/native-builder:focal docker.io/dashaun/native-builder:latest 85 | docker tag dashaun/native-builder:focal docker.io/dashaun/java-native-builder-arm64:latest 86 | docker push docker.io/dashaun/java-native-builder-arm64:7.37.0 87 | docker push docker.io/dashaun/java-native-builder-arm64:latest 88 | docker push docker.io/dashaun/native-builder:focal-arm64 89 | docker push docker.io/dashaun/native-builder:latest -------------------------------------------------------------------------------- /arm64-toml/bellsoft.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 the original author or authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | api = "0.7" 16 | 17 | [buildpack] 18 | description = "A Cloud Native Buildpack that provides the Bellsoft Liberica implementations of JREs and JDKs" 19 | homepage = "https://github.com/paketo-buildpacks/bellsoft-liberica" 20 | id = "paketo-buildpacks/bellsoft-liberica-arm64" 21 | keywords = ["java", "jvm", "jre", "jdk"] 22 | name = "Paketo Buildpack for BellSoft Liberica" 23 | sbom-formats = ["application/vnd.syft+json", "application/vnd.cyclonedx+json"] 24 | version = "{{.version}}" 25 | 26 | [[buildpack.licenses]] 27 | type = "Apache-2.0" 28 | uri = "https://github.com/paketo-buildpacks/bellsoft-liberica/blob/main/LICENSE" 29 | 30 | [metadata] 31 | include-files = ["LICENSE", "NOTICE", "README.md", "bin/build", "bin/detect", "bin/helper", "bin/main", "buildpack.toml"] 32 | pre-package = "scripts/build.sh" 33 | 34 | [[metadata.configurations]] 35 | default = "0" 36 | description = "the headroom in memory calculation" 37 | launch = true 38 | name = "BPL_JVM_HEAD_ROOM" 39 | 40 | [[metadata.configurations]] 41 | default = "35% of classes" 42 | description = "the number of loaded classes in memory calculation" 43 | launch = true 44 | name = "BPL_JVM_LOADED_CLASS_COUNT" 45 | 46 | [[metadata.configurations]] 47 | default = "250" 48 | description = "the number of threads in memory calculation" 49 | launch = true 50 | name = "BPL_JVM_THREAD_COUNT" 51 | 52 | [[metadata.configurations]] 53 | default = "" 54 | description = "write heap dumps on error to this path" 55 | launch = true 56 | name = "BPL_HEAP_DUMP_PATH" 57 | 58 | [[metadata.configurations]] 59 | default = "true" 60 | description = "enables Java Native Memory Tracking (NMT)" 61 | launch = true 62 | name = "BPL_JAVA_NMT_ENABLED" 63 | 64 | [[metadata.configurations]] 65 | default = "summary" 66 | description = "configure level of NMT, summary or detail" 67 | launch = true 68 | name = "BPL_JAVA_NMT_LEVEL" 69 | 70 | [[metadata.configurations]] 71 | default = "false" 72 | description = "enables Java Management Extensions (JMX)" 73 | launch = true 74 | name = "BPL_JMX_ENABLED" 75 | 76 | [[metadata.configurations]] 77 | default = "5000" 78 | description = "configure the JMX port" 79 | launch = true 80 | name = "BPL_JMX_PORT" 81 | 82 | [[metadata.configurations]] 83 | default = "false" 84 | description = "enables Java remote debugging support" 85 | launch = true 86 | name = "BPL_DEBUG_ENABLED" 87 | 88 | [[metadata.configurations]] 89 | default = "8000" 90 | description = "configure the remote debugging port" 91 | launch = true 92 | name = "BPL_DEBUG_PORT" 93 | 94 | [[metadata.configurations]] 95 | default = "false" 96 | description = "configure whether to suspend execution until a debugger has attached" 97 | launch = true 98 | name = "BPL_DEBUG_SUSPEND" 99 | 100 | [[metadata.configurations]] 101 | default = "false" 102 | description = "enables Java Flight Recording (JFR)" 103 | launch = true 104 | name = "BPL_JFR_ENABLED" 105 | 106 | [[metadata.configurations]] 107 | default = "" 108 | description = "configure custom Java Flight Recording (JFR) arguments" 109 | launch = true 110 | name = "BPL_JFR_ARGS" 111 | 112 | [[metadata.configurations]] 113 | build = true 114 | default = "false" 115 | description = "enables running jlink tool to generate custom JRE" 116 | name = "BP_JVM_JLINK_ENABLED" 117 | 118 | [[metadata.configurations]] 119 | build = true 120 | default = "--no-man-pages --no-header-files --strip-debug --compress=1" 121 | description = "configure custom link arguments (--output must be omitted)" 122 | name = "BP_JVM_JLINK_ARGS" 123 | 124 | [[metadata.configurations]] 125 | build = true 126 | default = "11" 127 | description = "the Java version" 128 | name = "BP_JVM_VERSION" 129 | 130 | [[metadata.configurations]] 131 | build = true 132 | default = "JRE" 133 | description = "the JVM type - JDK or JRE" 134 | name = "BP_JVM_TYPE" 135 | 136 | [[metadata.configurations]] 137 | description = "the JVM launch flags" 138 | launch = true 139 | name = "JAVA_TOOL_OPTIONS" 140 | 141 | [[metadata.dependencies]] 142 | cpes = ["cpe:2.3:a:oracle:jdk:1.8.0:update352:*:*:*:*:*:*:*"] 143 | id = "jdk" 144 | name = "BellSoft Liberica JDK" 145 | purl = "pkg:generic/bellsoft-jdk@8.0.352?arch=arm64" 146 | sha256 = "cc0c9d63e1680d2245ba567abee015a88c7161730d8882048afad309913f70f2" 147 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 148 | uri = "https://github.com/bell-sw/Liberica/releases/download/8u352+8/bellsoft-jdk8u352+8-linux-aarch64.tar.gz" 149 | version = "8.0.352" 150 | 151 | [[metadata.dependencies.licenses]] 152 | type = "GPL-2.0 WITH Classpath-exception-2.0" 153 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 154 | 155 | [[metadata.dependencies]] 156 | cpes = ["cpe:2.3:a:oracle:jre:1.8.0:update352:*:*:*:*:*:*:*"] 157 | id = "jre" 158 | name = "BellSoft Liberica JRE" 159 | purl = "pkg:generic/bellsoft-jre@8.0.352?arch=arm64" 160 | sha256 = "3a107dd1eaf417edd12efd991a23f16b176a492fd880919f0d3950b78c335ec3" 161 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 162 | uri = "https://github.com/bell-sw/Liberica/releases/download/8u352+8/bellsoft-jre8u352+8-linux-aarch64-musl.tar.gz" 163 | version = "8.0.352" 164 | 165 | [[metadata.dependencies.licenses]] 166 | type = "GPL-2.0 WITH Classpath-exception-2.0" 167 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 168 | 169 | [[metadata.dependencies]] 170 | cpes = ["cpe:2.3:a:oracle:jdk:11.0.17:*:*:*:*:*:*:*"] 171 | id = "jdk" 172 | name = "BellSoft Liberica JDK" 173 | purl = "pkg:generic/bellsoft-jdk@11.0.17?arch=arm64" 174 | sha256 = "58706e2d600847681c6444f5d118d86889c755b3f0b251a9359ce2ec09bf4e5b" 175 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 176 | uri = "https://github.com/bell-sw/Liberica/releases/download/11.0.17+7/bellsoft-jdk11.0.17+7-linux-aarch64-full.tar.gz" 177 | version = "11.0.17" 178 | 179 | [[metadata.dependencies.licenses]] 180 | type = "GPL-2.0 WITH Classpath-exception-2.0" 181 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 182 | 183 | [[metadata.dependencies]] 184 | cpes = ["cpe:2.3:a:oracle:jre:11.0.17:*:*:*:*:*:*:*"] 185 | id = "jre" 186 | name = "BellSoft Liberica JRE" 187 | purl = "pkg:generic/bellsoft-jre@11.0.17?arch=arm64" 188 | sha256 = "2a2269e04716ddfb29404a3c5ba8a766b744dbac16c8df9c879adf3ea308d942" 189 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 190 | uri = "https://github.com/bell-sw/Liberica/releases/download/11.0.17+7/bellsoft-jre11.0.17+7-linux-aarch64-full.tar.gz" 191 | version = "11.0.17" 192 | 193 | [[metadata.dependencies.licenses]] 194 | type = "GPL-2.0 WITH Classpath-exception-2.0" 195 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 196 | 197 | [[metadata.dependencies]] 198 | cpes = ["cpe:2.3:a:oracle:graalvm:22.1.0:*:*:*:community:*:*:*", "cpe:2.3:a:oracle:jdk:11.0.17:*:*:*:*:*:*:*"] 199 | id = "native-image-svm" 200 | name = "BellSoft Liberica NIK" 201 | purl = "pkg:generic/bellsoft-nik@22.3.0?arch=arm64" 202 | sha256 = "bceffb1ef594fcedb138122529809d5baac97d121ca50aa1eceaffa7122a36f1" 203 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 204 | uri = "https://download.bell-sw.com/vm/22.3.0/bellsoft-liberica-vm-core-openjdk11.0.17+7-22.3.0+2-linux-aarch64.tar.gz" 205 | version = "11.0.17" 206 | 207 | [[metadata.dependencies.licenses]] 208 | type = "GPL-2.0 WITH Classpath-exception-2.0" 209 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 210 | 211 | [[metadata.dependencies]] 212 | cpes = ["cpe:2.3:a:oracle:jdk:17.0.5:*:*:*:*:*:*:*"] 213 | id = "jdk" 214 | name = "BellSoft Liberica JDK" 215 | purl = "pkg:generic/bellsoft-jdk@17.0.5?arch=arm64" 216 | sha256 = "a8a10cacf05caa2292ac2df9ff787636b10ca0437b3b64f0567fadd99ecc8927" 217 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 218 | uri = "https://github.com/bell-sw/Liberica/releases/download/17.0.5+8/bellsoft-jdk17.0.5+8-linux-aarch64-full.tar.gz" 219 | version = "17.0.5" 220 | 221 | [[metadata.dependencies.licenses]] 222 | type = "GPL-2.0 WITH Classpath-exception-2.0" 223 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 224 | 225 | [[metadata.dependencies]] 226 | cpes = ["cpe:2.3:a:oracle:jre:17.0.5:*:*:*:*:*:*:*"] 227 | id = "jre" 228 | name = "BellSoft Liberica JRE" 229 | purl = "pkg:generic/bellsoft-jre@17.0.5?arch=arm64" 230 | sha256 = "a9889ba79611280fa453aff760e381a1d649a2bde954cae35c8905c6bc88f4a0" 231 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 232 | uri = "https://github.com/bell-sw/Liberica/releases/download/17.0.5+8/bellsoft-jre17.0.5+8-linux-aarch64-full.tar.gz" 233 | version = "17.0.5" 234 | 235 | [[metadata.dependencies.licenses]] 236 | type = "GPL-2.0 WITH Classpath-exception-2.0" 237 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 238 | 239 | [[metadata.dependencies]] 240 | cpes = ["cpe:2.3:a:oracle:graalvm:22.3.0:*:*:*:community:*:*:*", "cpe:2.3:a:oracle:jdk:17.0.5:*:*:*:*:*:*:*"] 241 | id = "native-image-svm" 242 | name = "BellSoft Liberica NIK" 243 | purl = "pkg:generic/bellsoft-nik@22.3.0?arch=arm64" 244 | sha256 = "37ae1cf06aa3707008c792932875fd00be7b7401af871fe3c037412ee32c533a" 245 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 246 | uri = "https://download.bell-sw.com/vm/22.3.0/bellsoft-liberica-vm-core-openjdk17.0.5+8-22.3.0+2-linux-aarch64.tar.gz" 247 | version = "17.0.5" 248 | 249 | [[metadata.dependencies.licenses]] 250 | type = "GPL-2.0 WITH Classpath-exception-2.0" 251 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 252 | 253 | [[metadata.dependencies]] 254 | cpes = ["cpe:2.3:a:oracle:jdk:19.0.1:*:*:*:*:*:*:*"] 255 | id = "jdk" 256 | name = "BellSoft Liberica JDK" 257 | purl = "pkg:generic/bellsoft-jdk@19.0.1?arch=arm64" 258 | sha256 = "8c6c71bd375932140dcaccc7fec4c41f57afa0460feb695a1885088b0f5d5dc9" 259 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 260 | uri = "https://github.com/bell-sw/Liberica/releases/download/19.0.1+11/bellsoft-jdk19.0.1+11-linux-aarch64-full.tar.gz" 261 | version = "19.0.1" 262 | 263 | [[metadata.dependencies.licenses]] 264 | type = "GPL-2.0 WITH Classpath-exception-2.0" 265 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 266 | 267 | [[metadata.dependencies]] 268 | cpes = ["cpe:2.3:a:oracle:jre:19.0.1:*:*:*:*:*:*:*"] 269 | id = "jre" 270 | name = "BellSoft Liberica JRE" 271 | purl = "pkg:generic/bellsoft-jre@19.0.1?arch=arm64" 272 | sha256 = "c8d125dd14ecdec675ad9b413891e50cc4a399ab0a3ef6f0cabcf64db696cda1" 273 | stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] 274 | uri = "https://github.com/bell-sw/Liberica/releases/download/19.0.1+11/bellsoft-jre19.0.1+11-linux-aarch64-full.tar.gz" 275 | version = "19.0.1" 276 | 277 | [[metadata.dependencies.licenses]] 278 | type = "GPL-2.0 WITH Classpath-exception-2.0" 279 | uri = "https://openjdk.java.net/legal/gplv2+ce.html" 280 | 281 | [[stacks]] 282 | id = "io.paketo.stacks.tiny" 283 | 284 | [[stacks]] 285 | id = "io.buildpacks.stacks.bionic" 286 | 287 | [[stacks]] 288 | id = "*" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Paketo Buildpacks ARM64 Build Instructions 2 | 3 | ## Prerequisites 4 | 5 | 1. Get yourself some ARM64 hardware (Mac M1) or a VM (Oracle Cloud has free ARM64 VMs) 6 | 2. Install some basic packages: make, curl, git, jq 7 | 3. Install Go version 1.20+. Follow instructions [here](https://go.dev/doc/install). 8 | If building on a Raspberry PI, the version of `golang` included with RaspiOS package manager does not work. 9 | 4. This is used later to package buildpacks: `go install github.com/paketo-buildpacks/libpak/cmd/create-package@v1.64.0`. 10 | 5. Install `yj` which is used by some of the helper scripts. run `go install github.com/sclevine/yj/v5@v5.1.0`. 11 | 6. Add `~/go/bin` to `$PATH`. Run `export PATH=$PATH:$HOME/go/bin`. 12 | 7. Install Docker. 13 | 14 | - For Mac, you can use Docker Desktop if you meet the criteria of their free-use license restrictions or you pay for a license but you can also use [Colima](https://github.com/abiosoft/colima), [Podman](https://podman.io/getting-started/installation#macos) or Kubernetes installations like Minikube that expose the Docker Daemon directly. 15 | - For Linux, follow [the instructions here](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository). 16 | - When done, run `docker pull ubuntu:latest` (or some other image) just to confirm Docker is working. 17 | 8. Install the `pack` CLI. There are MacOS & Linux arm64 builds on the project's [Github releases](https://github.com/buildpacks/pack/releases). Download and copy to `/usr/local/bin`. 18 | 9. Grab the scripts used in this article. `git clone https://github.com/dmikusa-pivotal/paketo-arm64`. 19 | 20 | ## Create a Stack 21 | 22 | Basically [follow the stack creation instructions here](https://buildpacks.io/docs/operator-guide/create-a-stack/). 23 | 24 | The instructions below are customized to use `ubuntu:focal` as the base image. You can use other base images, but you need to ensure there is a compatile ARM64 image available. For example, you cannot use `paketobuildpacks/build` or `paketobuildpacks/run` because these do not have ARM64 images at the moment. When Paketo is publishing ARM64 images for it's build/run images, you can skip this step and use them directly. 25 | 26 | In the meantime: 27 | 28 | 1. Get a base image, `sudo docker pull ubuntu:focal` 29 | 2. `cd paketo-arm64/stack` 30 | 3. Customize the `Dockerfile` 31 | 32 | You can customize the creation of the image in any way you need, for example if you need to add additional packages or tools to the build or run images. Just be aware that with the run image, whatever you add will end up in the final images used by application images you build. 33 | 34 | When you're ready, build the images: 35 | 36 | 1. Build the run image: `sudo docker build . -t dmikusa2pivotal/stack-run:focal --target run --build-arg STACK_ID=""` 37 | 2. Build the build image: `sudo docker build . -t dmikusa2pivotal/stack-build:focal --target build --build-arg STACK_ID=""` 38 | 39 | Your stack id can be anything, it just needs to be consistent across both images, and you also need to pass the value into the script when you create the builder below. 40 | 41 | Congrats! You now have stack images. 42 | 43 | ## Package your Buildpacks 44 | 45 | Next we need to build and package all of the buildpacks, with a few modifications. This is a tedious process, so I'm including some scripts to make it easier. There is still a little bit of manual work required, but it's a lot simpler with the scripts. 46 | 47 | Here's the general process that is mostly automated by the scripts: 48 | 49 | 1. Clone and checkout all of the buildpacks we need. 50 | 2. Update buildpack.toml and package.toml to have unique ids [1]. 51 | 3. Update any dependencies that are architecture specific to reference arm64 downloads. For Java, this is fortunately a small list: bellsoft-liberica, syft, and watchexec. [2] 52 | 4. Build the buildpacks. This includes the changes above and compiles arm64 binaries for build and detect. 53 | 5. Package the buildpacks into arm64 images. 54 | 55 | [1] The current suite of packaging tools do not support manifest images, so you need to tag your images as `-arm64` or something to differenitate them from the standard buildpack images which are x86. 56 | [2] This is a manual step. 57 | 58 | Here are updated buildpack.toml files at the time of writing. You will need to manually check if there are newer versions of dependencies and update the buildpack.toml entries accordingly to ensure you have the latest dependencies. 59 | 60 | 1. [bellsoft-liberica](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/arm64-toml/bellsoft.toml) 61 | 2. [syft](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/syft.toml) 62 | 3. [watchexec](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/watchexec.toml) 63 | 64 | The means the steps to execute are as follows: 65 | 66 | 1. `./scripts/clone.sh ` 67 | 2. `find ./buildpacks -name "buildpack.toml" | xargs -n 1 ./scripts/mod-bptoml.sh` 68 | 3. `find ./buildpacks -name "package.toml" | xargs -n 1 ./scripts/mod-pkgtoml.sh` 69 | 4. Copy the `buildpack.toml` files for the three buildpacks referenced above from `paketo-arm64/arm64-toml`. Overwrite the `buildpack.toml` file in the project folder under the working directory with each. [1] 70 | 5. `./scripts/build.sh ` 71 | 72 | [1] This example works for `paketo-buildpacks/java` and will require three modified `buildpack.toml` files. You may not need all three if you use a different composite buildpack, like `paketo-buildpacks/java-native-image` which only requires bellsoft and syft. Other composite buildpacks may require more modifications, it depends native code gets installed by that suite of buildpacks. 73 | 74 | At this point, you should have images. Run `docker images` to see what's there. 75 | 76 | If you want to start over run `./scripts/reset.sh ` or re-run the first step. The reset script will be slightly faster as it doesn't need to redownload everything. 77 | 78 | ## Create a Builder 79 | 80 | Once you have buildpack images, it's time to build an builder image. There is a script for this as well. It'll generate a `builder.toml` file based on some input information and run `pack create builder` on that. 81 | 82 | Run `create-builder.sh ` 83 | 84 | The required information is as follows: 85 | 86 | - The composite buildpack id 87 | - The composite buildpack version 88 | - A lifecycle version to use, whatever is latest often works best 89 | - Your custom run image from above 90 | - Your custom build build image from above 91 | - The stack id you used when creating the stack above 92 | - The name of your builder image 93 | 94 | Here are a couple of examples: 95 | 96 | - For `paketo-buildpacks/java` -> `./scripts/create-builder.sh paketo-buildpacks/java 6.4.0 0.14.0 docker.io/dmikusa2pivotal/stack-run:focal docker.io/dmikusa2pivotal/stack-build:focal com.mikusa.stacks.focal dmikusa2pivotal/builder:focal` 97 | - For `paketo-buildpacks/java-native-image` -> `./scripts/create-builder.sh paketo-buildpacks/java-native-image 7.4.0 0.14.0 docker.io/dmikusa2pivotal/stack-run:focal docker.io/dmikusa2pivotal/stack-build:focal com.mikusa.stacks.focal dmikusa2pivotal/native-builder:focal` 98 | - For `paketo-community/rust` -> `./scripts/create-builder.sh paketo-community/rust 0.10.0 0.14.0 docker.io/dmikusa2pivotal/rust-stack-run:focal docker.io/dmikusa2pivotal/rust-stack-build:focal com.mikusa.stacks.focal dmikusa2pivotal/rust-builder:focal` 99 | 100 | At this point, you should have a builder with all of your buildpacks. Time to build some apps! 101 | 102 | ## Build Samples 103 | 104 | 1. `git clone https://github.com/paketo-buildpacks/samples` 105 | 2. Install Java 106 | 3. `cd samples/java/maven` 107 | 4. `./mvnw package` 108 | 5. `sudo ~/pack/out/pack build apps/maven -p target/demo-0.0.1-SNAPSHOT.jar -B docker.io/dmikusa2pivotal/builder:focal --trust-builder` 109 | 110 | It should now build & package up the app as an image. 111 | 112 | ## Troubleshooting 113 | 114 | - `pack` not found. This can happen if you modify `$PATH` as some scripts use `sudo` but `sudo` won't inherit your custom `$PATH` by default. It's easier to put the required binaries into the `/usr/local/bin` directory or symlink them. 115 | 116 | - If `create-builder.sh` fails, look at `buildpacks/builder/builder.toml`. This is the file that is generated. Review the input data to make sure you've entered the proper information. Often when it fails, it's because the information is not consistent across the buildpacks and builder metadata. 117 | 118 | - There may be some issues running on Mac OS. This was tested on ARM64 Linux. For example, the script assumes you need to `sudo` when interacting with the Docker Daemon, which is not true on Mac OS. Open an issue or submit a PR if anything comes up. 119 | 120 | ## Details on the Automation Scripts 121 | 122 | Here is a breakdown of the scripts that you can use to mostly automate this process. If you just want to build, you can probably skip this section. It just provides more information for those that are curious. 123 | 124 | 1. [clone.sh](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/scripts/clone.sh) can be used to quickly clone all of the buildpack repositories. It requires the buildpack id and version of a composite buildpack (buildpack that references other buildpacks). It will then go and clone all of the component (referenced buildpacks) and check out the version of those buildpacks set in the composite buildpack. 125 | 126 | For example: `./clone.sh paketo-buildpacks/java 6.4.0`. Will clone all of the referenced component buildpacks & the composite buildpack to the working directory (`./buildpacks`). 127 | 128 | 2. [mod-bptoml.sh](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/scripts/mod-bptoml.sh) can be used to quickly change the buildpack id of all the buildpacks. It will go through and append `-arm64` to the end of each buildpack id. This is useful so that there is something to differentiate between the images you're creating and standard x86 images. 129 | 130 | For example: `find ./buildpacks -name "buildpack.toml" | xargs -n 1 ./mod-bptoml.sh`. This will find all of the buildpack.toml files in the working directory and update them. 131 | 132 | 3. [mod-pkgtoml.sh](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/scripts/mod-pkgtoml.sh) can be used to quickly change the image name of all the buildpacks. It will go through and append `-arm64` to the end of each image name. This is useful so that there is something to differentiate between the images you're creating and standard x86 images. 133 | 134 | For example: `find ./buildpacks -name "buildpack.toml" | xargs -n 1 ./mod-bptoml.sh`. This will find all of the buildpack.toml files in the working directory and update them. 135 | 136 | 4. [build.sh](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/scripts/build.sh) can be used to iterate over all of the buildpacks in the working directory (created by `clone.sh`). 137 | 138 | For example: `./build.sh paketo-buildpacks/java`. 139 | 140 | 5. [reset.sh](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/scripts/reset.sh) can be used to reset the temporary directory to a given working state. You pass it the composite buildpack id and version. It will reset, pull and check out that version. Then recursively do the same for all referenced buildpacks. 141 | 142 | For example: `./reset.sh paketo-buildpacks/java 6.4.0`. This will reset the working directory to the 6.4.0 version. If this fails, like if new buildpacks have been introduced, then you should run `clone.sh` instead. Running `clone.sh` is similar but wipes and results in a fresh working directory. 143 | 144 | 6. [create-builder.sh](https://github.com/dmikusa-pivotal/paketo-arm64/blob/main/create-builder.sh) can be used to generate a `builder.toml` and create a builder image. This works by generating a builder.toml based on the information passed into it and what's in the referenced composite buildpack's `buildpack.toml` file. This requires a lot of input so see [this section](#create-a-builder) for details on running it. 145 | 146 | ## Updating to new versions - manual process 147 | 148 | 149 | 150 | 1. For each file in `arm64-toml` 151 | 1. Pull the latest version of the buildpack.toml 152 | 2. Do a diff and update the dependencies and the SHA values for ARM64/aarch64 versions 153 | 154 | 2. Update `.github/workflows/paketo-arm64` versions for builder and lifecycle 155 | --------------------------------------------------------------------------------