Skip to content
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
4 changes: 2 additions & 2 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ RUN case "$(go env GOARCH)" in \
amd64) TRIVY_ARCH="64bit" ;; \
s390x) TRIVY_ARCH="s390x" ;; \
*) TRIVY_ARCH="" ;; \
esac
RUN if [ -n "${TRIVY_ARCH}" ]; then \
esac && \
if [ -n "${TRIVY_ARCH}" ]; then \
wget --no-verbose "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-${TRIVY_ARCH}.tar.gz" \
&& tar -zxvf "trivy_${TRIVY_VERSION}_Linux-${TRIVY_ARCH}.tar.gz" \
&& mv trivy /usr/local/bin; \
Expand Down
11 changes: 5 additions & 6 deletions scripts/image_scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

set -e

if [ -z $1 ] && [ -z $2 ]; then
echo "error: image name and arch name are required as arguments. exiting..."
if [ -z $1 ]; then
echo "error: image name is required as argument. exiting..."
exit 1
fi

ARCH=$2

# skipping image scan for 32 bits image since trivy dropped support for those https://github.com/aquasecurity/trivy/discussions/4789
if [[ "${ARCH}" = "arm" ]] || [ "${ARCH}" != "386" ]; then
# we wont have trivy installed if its an unsupported arch
if [ -z "$(which trivy)" ]; then
echo "warning: trivy scan being skipped since 'trivy' executable not found in path"
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/package-image
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ IMAGE_NAME=${IMAGE_NAME:-k3s}

IMAGE=${REPO}/${IMAGE_NAME}:${TAG}
docker build --build-arg DRONE_TAG=${VERSION_TAG} -t ${IMAGE} -f package/Dockerfile .
./scripts/image_scan.sh ${IMAGE} ${ARCH}
./scripts/image_scan.sh ${IMAGE}
echo Built ${IMAGE}