ARG GO_VERSION=alpine FROM golang:${GO_VERSION} as build ARG NODE_10_SRC="http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64" # NPM_APK=$(wget -qO- "${NODE_10_SRC}" | gawk 'match($0,/^.*href="(npm-10\..*\.apk)".*$/,ary) { print ary[1] }') && \ # wget -O nodejs10.apk "${NODE_10_SRC}/${NODE_APK}" && \ # wget -O npm10.apk "${NODE_10_SRC}/${NODE_APK}" && \ # apk add nodejs10.apk npm10.apk RUN \ apk update --no-cache && \ apk add --no-cache gawk && \ NODE_APK=$(wget -qO- "${NODE_10_SRC}" | gawk 'match($0,/^.*href="(nodejs-10\..*\.apk)".*$/,ary) { print ary[1] }') && \ wget -O nodejs10.apk "${NODE_10_SRC}/${NODE_APK}" && \ apk add nodejs10.apk RUN \ apk update --no-cache &&\ apk add --no-cache \ bash \ git \ make \ npm \ yarn && \ git config --global advice.detachedHead false ARG VAULT_VERSION= ARG VAULT_REPO ARG BUILD_PATH=vault RUN --mount=type=tmpfs,target=/go/src/ \ echo "selected repo: ${VAULT_REPO}" && \ if [ -z "${VAULT_VERSION}" ]; then \ VAULT_VERSION=$( \ git ls-remote "${VAULT_REPO}" | \ awk '$2 ~ /^refs\/tags\/v[0-9]+\.[0-9]+\.[0-9]+$/ { print substr($2,11) }' | sort -V | tail -n1 \ ) ; \ fi && \ echo "selected vault branch: ${VAULT_VERSION}" && \ BUILD_PATH=$(echo "${VAULT_REPO}" | sed -E 's/^.*\/\/(.*)\.git/\1/') && \ BUILD_PATH="/go/src/${BUILD_PATH}" && \ git clone \ --branch="${VAULT_VERSION}" \ --depth=1 \ "${VAULT_REPO}" \ "${BUILD_PATH}" && \ cd "${BUILD_PATH}" && \ make static-dist dev-ui && \ cp /go/bin/vault /vault FROM alpine:3 as runtime RUN addgroup vault && \ adduser -S -G vault vault RUN \ mkdir -p \ /vault/file \ /vault/config && \ chown -R vault:vault /vault COPY --from=build /vault /bin/vault ENTRYPOINT /bin/vault server -config /vault/config