Skip to content

Commit

Permalink
add VERSION build arg
Browse files Browse the repository at this point in the history
  • Loading branch information
awahlig committed Feb 6, 2024
1 parent d5f157a commit dd7d9ef
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
FROM alpine AS build

ARG TARGETPLATFORM
ARG VERSION

RUN apk add --update curl jq
RUN if [ -z "$VERSION" ]; then echo "VERSION is required" && exit 1; fi

RUN apk add --update curl

RUN arch=$(echo ${TARGETPLATFORM} | cut -d/ -f2) \
&& tarball=$(curl 'https://pkgs.tailscale.com/stable/?mode=json' | jq -r .Tarballs.${arch}) \
&& version=$(echo ${tarball} | cut -d_ -f2) \
&& curl "https://pkgs.tailscale.com/stable/${tarball}" -o tailscale.tgz \
&& tarball=tailscale_${VERSION}_${arch} \
&& curl -f "https://pkgs.tailscale.com/stable/${tarball}.tgz" -o tailscale.tgz \
&& tar xzf tailscale.tgz \
&& mkdir -p /root-layer/usr/bin /root-layer/usr/sbin \
&& cp -vrf "tailscale_${version}_${arch}"/tailscale /root-layer/usr/bin/tailscale \
&& cp -vrf "tailscale_${version}_${arch}"/tailscaled /root-layer/usr/sbin/tailscaled
&& cp -vrf "${tarball}/tailscale" /root-layer/usr/bin/tailscale \
&& cp -vrf "${tarball}/tailscaled" /root-layer/usr/sbin/tailscaled

COPY root/ /root-layer/

Expand Down

0 comments on commit dd7d9ef

Please sign in to comment.