Updated tester tool to use the tool-downloader

This commit is contained in:
Bojan Čekrlić 2020-10-23 11:06:58 +02:00
parent 5aca4e36dc
commit 1569848df0
2 changed files with 10 additions and 23 deletions

View file

@ -1,13 +1,19 @@
# ---- MAILSEND ----
FROM boky/alpine-bootstrap AS mailsend
COPY install_mailsend.sh /tmp/
RUN chmod +x /tmp/install_mailsend.sh && /tmp/install_mailsend.sh
FROM boky/tool-downloader AS mailsend
RUN \
env \
VERSION='1.0.9' \
PROJECT='muquit/mailsend-go' \
POST_INSTALL='cp mailsend-go-dir/mailsend-go /usr/local/bin && chmod +x /usr/local/bin/mailsend-go' \
DOWNLOAD_TEMPLATE='$( if [[ "${GOARCH}" == "aarch64" ]] || [[ "${GOARCH}" == "amd64" ]]; then GOARCH="64bit"; elif [[ "${GOARCH}" == "arm" ]]; then GOARCH="ARM"; fi; echo "https://github.com/${PROJECT}/releases/download/v${VERSION}/${NAME}_${VERSION}_${GOOS}-${GOARCH}${GOOS_ARCHIVE_STYLE}" )' \
tool-downloader
# ---- TEST ----
FROM boky/alpine-bootstrap
RUN apk add --no-cache bash bats
COPY --from=mailsend /tmp/mailsend-go-dir/mailsend-go /usr/local/bin/mailsend
COPY --from=mailsend /usr/local/bin/mailsend-go /usr/local/bin/mailsend
WORKDIR /code
ENTRYPOINT ["/usr/bin/bats"]

View file

@ -1,19 +0,0 @@
#!/usr/bin/env bash
set -e
install_mailsend() {
local ARCH="$(uname -m)"
local MAILSEND_VERSION="1.0.9"
if [[ "$ARCH" == "x86_64" ]]; then
ARCH="64bit"
else
ARCH="ARM"
fi
cd /tmp
curl -LsS https://github.com/muquit/mailsend-go/releases/download/v${MAILSEND_VERSION}/mailsend-go_${MAILSEND_VERSION}_linux-${ARCH}.tar.gz | tar xzfv -
chmod +x /tmp/mailsend-go-dir/mailsend-go
}
install_mailsend