2018-04-06 18:37:58 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euxo pipefail
|
|
|
|
|
2020-02-18 16:24:11 +00:00
|
|
|
# Packages required to build the image
|
|
|
|
pkg_build=(
|
|
|
|
jq
|
|
|
|
tar
|
|
|
|
)
|
|
|
|
|
|
|
|
# Packages kept for the final image
|
|
|
|
pkg_img=(
|
|
|
|
bash
|
|
|
|
ca-certificates
|
|
|
|
curl
|
|
|
|
docker
|
|
|
|
git
|
|
|
|
make
|
|
|
|
)
|
|
|
|
|
|
|
|
# Install required packages
|
|
|
|
apk --no-cache add "${pkg_build[@]}" "${pkg_img[@]}"
|
|
|
|
|
|
|
|
function get_asset_url() {
|
|
|
|
curl -sSfL "https://api.github.com/repos/${1}/releases/latest" |
|
|
|
|
jq -r '.assets | .[] | .browser_download_url' |
|
|
|
|
grep -E 'linux.*amd64'
|
|
|
|
}
|
|
|
|
|
2018-04-06 18:37:58 +00:00
|
|
|
# Download latest release of inner-runner
|
2020-02-18 16:24:11 +00:00
|
|
|
curl -sSfL "$(get_asset_url repo-runner/repo-runner | grep inner-runner)" | tar -xzf - -C /usr/local/bin
|
2018-04-06 18:37:58 +00:00
|
|
|
mv /usr/local/bin/inner-runner* /usr/local/bin/inner-runner
|
2020-02-18 16:24:11 +00:00
|
|
|
|
|
|
|
# Download latest release of golangci-lint
|
|
|
|
curl -sSfL "$(get_asset_url golangci/golangci-lint)" | tar -xzf - -C /usr/local/bin --wildcards '*/golangci-lint' --strip-components=1
|
|
|
|
|
|
|
|
# Purge build-packages
|
|
|
|
apk --no-cache del --purge "${pkg_build[@]}"
|