Docker Community Forums

Share and learn in the Docker community.

My dockerfile needs to download a project from github. What's the best approach?

I want my dockerfile to, after installing Alpine Linux,
locate a package in github, depending on the architecture of the machine
download and install it.

It the second part I have trouble with.

Below is my attempt:


FROM alpine:3.14
LABEL version="1.0"
LABEL maintainer="Folât Pjêrsômêj"
LABEL release-date="2021-07-20"

RUN apk add curl 
RUN apk add jq

ARG ARCH=$(uname -m)

# Find Package name
RUN if [ "$ARCH" = "aarch64" ] ; then \
    PACKAGE_NAME= echo "aarch64-unknown-linux-musl"; \ 
  else if [ "$ARCH" = "armv7l" ]
    PACKAGE_NAME= echo "armv7-unknown-linux-musleabihf"; \
    echo "I'm sorry, but your architecture is not available for this application."

# Install the app
RUN curl -L $(curl --silent \ 
| jq -r '.assets[] | select(.name | endswith($PACKAGE.tar.gz")).browser_download_url')

CMD ["sh"]

Is this the right approach and should I figure out how to correctly assign ARCH and PACKAGE_NAME,
or is this something that should not even be in the dockerfile and be completely somewhere else?