Skip to content
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

adds 7zip to builder-base #1448

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions builder-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ RUN --mount=type=cache,target=/var/cache/yum,sharing=locked \
/install_yq.sh && \
/remove_yum_packages.sh

FROM ${BUILDER_IMAGE} as sevenzip
ARG TARGETARCH
WORKDIR /workdir
ARG SEVENZIP_VERSION
ENV SEVENZIP_VERSION=$SEVENZIP_VERSION

COPY --link --from=upx /upx /
COPY ./scripts/install_base_yum_packages.sh ./scripts/remove_yum_packages.sh ./scripts/common_vars.sh \
./scripts/install_7zip.sh ./checksums/7zip-${TARGETARCH}-checksum /
RUN --mount=type=cache,target=/var/cache/yum,sharing=locked \
/install_base_yum_packages.sh && \
/install_7zip.sh && \
/remove_yum_packages.sh

FROM ${BUILDER_IMAGE} as packer
ARG TARGETARCH
WORKDIR /workdir
Expand Down Expand Up @@ -539,6 +553,7 @@ COPY --link --from=skopeo /skopeo /
COPY --link --from=upx /upx /
COPY --link --from=notation /notation /
COPY --link --from=oras /oras /
COPY --link --from=sevenzip /7zip /

FROM minimal-copy-stage as full-copy-stage

Expand Down
1 change: 1 addition & 0 deletions builder-base/checksums/7zip-amd64-checksum
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
807bd858433b13215abc915cbb9ccdc806fc7b421418a4088a194e1729a6a6b2 7z2406-linux-x64.tar.xz
1 change: 1 addition & 0 deletions builder-base/checksums/7zip-arm64-checksum
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bc7337381e07c6ecdc872adc3636b9abd8a00a61543880777bbc3bb7acb5330d 7z2406-linux-arm64.tar.xz
43 changes: 43 additions & 0 deletions builder-base/scripts/install_7zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
set -o pipefail

SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"

NEWROOT=/7zip

source $SCRIPT_ROOT/common_vars.sh

if [ $TARGETARCH == 'amd64' ]; then
ARCH='x64'
else
ARCH='arm64'
fi

SEVENZIP_DOWNLOAD_URL="https://github.com/ip7z/7zip/releases/download/${SEVENZIP_VERSION}/7z${SEVENZIP_VERSION//.}-linux-${ARCH}.tar.xz"

function install_7zip() {
wget \
--progress dot:giga \
$SEVENZIP_DOWNLOAD_URL
sha256sum -c $BASE_DIR/7zip-$TARGETARCH-checksum
tar -C $USR_BIN -xJf 7z${SEVENZIP_VERSION//.}-linux-${ARCH}.tar.xz 7zz License.txt

time upx --best --no-lzma $USR_BIN/7zz
}

[ ${SKIP_INSTALL:-false} != false ] || install_7zip
4 changes: 4 additions & 0 deletions builder-base/scripts/update_shasums.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ for TARGETARCH in arm64 amd64; do

# Oras
echo "$(curl -sSL --retry 5 -v $ORAS_CHECKSUM_URL 2>&1 | grep $ORAS_FILENAME | cut -d ":" -f 2)" > $CHECKSUMS_ROOT/checksums/oras-$TARGETARCH-checksum

# 7zip
sha256=$(curl -sSL --retry 5 $SEVENZIP_DOWNLOAD_URL | sha256sum | awk '{print $1}')
echo "$sha256 7z${SEVENZIP_VERSION//.}-linux-${ARCH}.tar.xz" > $CHECKSUMS_ROOT/checksums/7zip-$TARGETARCH-checksum
done

# HUGO
Expand Down
2 changes: 1 addition & 1 deletion builder-base/scripts/validate_components.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ docker buildx version
buildctl --version
aws --version
bash --version

7zz

if [ $TARGETARCH == 'amd64' ]; then
hugo version
Expand Down
1 change: 1 addition & 0 deletions builder-base/scripts/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ source $SCRIPT_ROOT/install_bash.sh
source $SCRIPT_ROOT/install_upx.sh
source $SCRIPT_ROOT/install_notation.sh
source $SCRIPT_ROOT/install_oras.sh
source $SCRIPT_ROOT/install_7zip.sh
1 change: 1 addition & 0 deletions builder-base/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ OVERRIDE_BASH_VERSION: 4.3
PACKER_VERSION: 1.9.5
PACKER_ANSIBLE_PLUGIN: v1.1.1
PYWINRM_VERSION: 0.4.1
SEVENZIP_VERSION: 24.06
SKOPEO_VERSION: v1.5.2
SKOPEO_VERSION_AL23: v1.13.3
UPX_VERSION: 4.2.0
Expand Down
Loading