From 477e2a1332f07a571c46be08883cf6d3fb5caa0d Mon Sep 17 00:00:00 2001 From: ahrav Date: Wed, 11 Jan 2023 18:58:05 -0800 Subject: [PATCH] Update entrypoint (#1013) * Update entrypoint. * update comment. * Call each extra arg on its own. * Update loop. * Update extra args. * Use miccah's magic script. * Fix path to bash. * update entrypoint. * Add bash to Dockerfile. * update goreleaser dockerfile. --- Dockerfile | 2 +- Dockerfile.goreleaser | 2 +- entrypoint.sh | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 817f4da7..64e29922 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \ GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o trufflehog . FROM alpine:3.15 -RUN apk add --no-cache git ca-certificates \ +RUN apk add --no-cache bash git ca-certificates \ && rm -rf /var/cache/apk/* && \ update-ca-certificates COPY --from=builder /build/trufflehog /usr/bin/trufflehog diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser index aa79ef33..dc4cfda3 100644 --- a/Dockerfile.goreleaser +++ b/Dockerfile.goreleaser @@ -1,6 +1,6 @@ FROM alpine:3.15 -RUN apk add --no-cache git ca-certificates \ +RUN apk add --no-cache bash git ca-certificates \ && rm -rf /var/cache/apk/* && \ update-ca-certificates WORKDIR /usr/bin/ diff --git a/entrypoint.sh b/entrypoint.sh index 4ef5e69b..7db98e4b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,6 @@ -#!/usr/bin/env ash +#!/usr/bin/env bash -# `$*` expands the `args` supplied in an `array` individually -# or splits `args` in a string separated by whitespace. -/usr/bin/trufflehog $* \ No newline at end of file +# Parse the last argument into an array of extra_args. +mapfile -t extra_args < <(bash -c "for arg in ${*: -1}; do echo \$arg; done") + +/usr/bin/trufflehog "${@: 1: $#-1}" "${extra_args[@]}" \ No newline at end of file