dl is an ultra simple ultra light command designed to download a using http and outputs to stdout
GO111MODULE=on go run github.com/edwarnicke/dl ${url} > ${filename}GO111MODULE=on go run github.com/edwarnicke/dl \
https://github.com/spiffe/spire/releases/download/v0.9.3/spire-0.9.3-linux-x86_64-glibc.tar.gz > \
spire-0.9.3-linux-x86_64-glibc.tar.gzIf you are trying to download a tarball, its simple to pipe it to tar:
GO111MODULE=on go run github.com/edwarnicke/dl ${url to tar.gz} | tar -xzvf -GO111MODULE=on go run github.com/edwarnicke/dl \
https://github.com/spiffe/spire/releases/download/v0.9.3/spire-0.9.3-linux-x86_64-glibc.tar.gz | \
tar -xzvf -To unpack the tarball to a particular directory
GO111MODULE=on go run github.com/edwarnicke/dl ${url to tar.gz} | tar -xzvf - -C ${directory to unpack in}GO111MODULE=on go run github.com/edwarnicke/dl \
https://github.com/spiffe/spire/releases/download/v0.9.3/spire-0.9.3-linux-x86_64-glibc.tar.gz | \
tar -xzvf - -C /optTo unpack the tarball to a particular directory and extract only specified files
GO111MODULE=on go run github.com/edwarnicke/dl ${url to tar.gz} | tar -xzvf - -C ${directory to unpack in} ${list of files in your tarball you want to extract}GO111MODULE=on go run github.com/edwarnicke/dl \
https://github.com/spiffe/spire/releases/download/v0.9.3/spire-0.9.3-linux-x86_64-glibc.tar.gz | \
tar -xzvf - -C /opt ./spire-0.9.3/bin/spire-serverYou can even strip off the leading path:
GO111MODULE=on go run github.com/edwarnicke/dl ${url to tar.gz} | tar -xzvf - -C ${directory to unpack in} -strip=3 ${list of files in your tarball you want to extract} GO111MODULE=on go run github.com/edwarnicke/dl \
https://github.com/spiffe/spire/releases/download/v0.9.3/spire-0.9.3-linux-x86_64-glibc.tar.gz | \
tar -xzvf - -C /bin -strip=3 ./spire-0.9.3/bin/spire-server ./spire-0.9.3/bin/spire-agent ARG URL
FROM ${image}
RUN GO111MODULE=on go run github.com/edwarnicke/dl \
https://github.com/spiffe/spire/releases/download/v0.9.3/spire-0.9.3-linux-x86_64-glibc.tar.gz | \
tar -xzvf - -C /bin --strip=3 ./spire-0.9.3/bin/spire-server ./spire-0.9.3/bin/spire-agent which will have spire-server and spire-agent installed in /bin of the docker container