mirror of
https://github.com/mr0xb/dotfiles.git
synced 2026-08-27 19:34:57 -04:00
docker
This commit is contained in:
parent
fcb567094e
commit
50261d8e1c
9 changed files with 241 additions and 0 deletions
30
docker-img/github-dind/Dockerfile
Normal file
30
docker-img/github-dind/Dockerfile
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
FROM registry.ic-ops.net/base/docker:23-dind
|
||||
|
||||
ARG GOOS=linux
|
||||
ARG GOARCH=amd64
|
||||
ARG VAULT_VERS=1.12.1
|
||||
ARG GO_VERS=latest
|
||||
ARG GO_TARGET_DIR=/usr/local/share
|
||||
ARG JQ_VERS=latest
|
||||
ARG YQ_VERS=latest
|
||||
|
||||
ENV ENV="/root/.profile"
|
||||
|
||||
RUN curl -L "https://github.com/mikefarah/yq/releases/${YQ_VERS}/download/yq_linux_amd64" -o "/usr/local/bin/yq" \
|
||||
&& chmod +x /usr/local/bin/yq
|
||||
RUN curl -L "https://github.com/jqlang/jq/releases/${JQ_VERS}/download/jq-linux-amd64" -o "/usr/local/bin/jq" \
|
||||
&& chmod +x /usr/local/bin/jq
|
||||
RUN curl -L "https://releases.hashicorp.com/vault/${VAULT_VERS}/vault_${VAULT_VERS}_linux_amd64.zip" -o /tmp/vault_${VAULT_VERS}_linux_amd64.zip \
|
||||
&& unzip /tmp/vault_${VAULT_VERS}_linux_amd64.zip \
|
||||
&& mv vault /usr/local/bin/vault \
|
||||
&& rm /tmp/vault_${VAULT_VERS}_linux_amd64.zip
|
||||
|
||||
COPY install-go /tmp/install-go
|
||||
RUN chmod +x /tmp/install-go \
|
||||
&& sh /tmp/install-go \
|
||||
&& rm /tmp/install-go
|
||||
|
||||
ENV PATH="/usr/local/bin/:$GO_TARGET_DIR/go/bin:$PATH"
|
||||
ENV GOPATH="$GO_TARGET_DIR/go"
|
||||
ENV GOBIN="$GO_TARGET_DIR/go/bin"
|
||||
|
||||
37
docker-img/github-dind/install-go
Normal file
37
docker-img/github-dind/install-go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
TARGETDIR=${GO_TARGET_DIR:="/usr/local/"}
|
||||
|
||||
lookup_file() {
|
||||
curl -sSL "https://go.dev/dl/?mode=json" |
|
||||
jq -r '.[0].files[]
|
||||
| select(.os == "'"$GOOS"'")
|
||||
| select(.arch == "'"$GOARCH"'")
|
||||
| .filename'
|
||||
}
|
||||
|
||||
fetch() {
|
||||
local filename
|
||||
if [ $GO_VERS == "latest" ]; then
|
||||
filename="$(lookup_file)"
|
||||
else
|
||||
filename="$GO_VERS.$GOOS-$GOARCH.tar.gz"
|
||||
fi
|
||||
[[ -z "$filename" ]] && echo "unable to fetch filename" 1>&2 && return 1
|
||||
local path="/tmp/$filename"
|
||||
[[ -n "$DOWNLOADS" ]] && [[ -d "$DOWNLOADS" ]] && path="$DOWNLOADS/$filename"
|
||||
curl -L "https://go.dev/dl/$filename" -o "$path"
|
||||
echo "$path"
|
||||
}
|
||||
|
||||
install_latest_go() {
|
||||
local dir="$1" path
|
||||
[[ -z "$dir" ]] && dir="$TARGETDIR"
|
||||
[[ -z "$dir" ]] && dir="$HOME/.local"
|
||||
mkdir -p "$dir" 2>/dev/null
|
||||
path="$(fetch)"
|
||||
[[ -z "$path" ]] && echo "unable to fetch go tarball" 1>&2 && return 1
|
||||
rm -rf "$dir/go" && tar -C "$dir" -xzf "$path"
|
||||
}
|
||||
|
||||
install_latest_go "$@"
|
||||
Loading…
Reference in a new issue