1

I'm trying to get the version number of the latest release of a Github. (Stored in the LATEST_VERSION argument). Using this, I want to download a particular file from a GitHub repository (Using the ADD) command, however I am getting an error Error Image Screenshot

FROM adoptopenjdk/openjdk11:jdk-11.0.6_10-alpine
RUN mkdir -p /home/app
ARG ORG_NAME=archu0212
ARG REPO_NAME=Test
ARG LATEST_VERSION=$(curl -s https://api.github.com/repos/${ORG_NAME}/${REPO_NAME}/releases/latest | grep "tag_name" | cut -d'v' -f2 | cut -d'"' -f1)
ADD https://github.com/${ORG_NAME}/${REPO_NAME}/releases/download/v${LATEST_VERSION}/MainTestFile.jar /home/app
ENTRYPOINT ["java", "-jar", "/home/app"]
 docker build -t test-image .

 Building 2.0s (6/7)                                                                                                                                                                                     
 => [internal] load build definition from Dockerfile                                                                                                                                                   0.0s
 => => transferring dockerfile: 649B                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/adoptopenjdk/openjdk11:jdk-11.0.6_10-alpine                                                                                                                 1.4s
 => [1/3] FROM docker.io/adoptopenjdk/openjdk11:jdk-11.0.6_10-alpine@sha256:a4e96cebf2f00b354b6f935560d4e64ad24435af77322cdf538975962d7e17d3                                                           0.0s
 => ERROR https://github.com/archu0212/Test/releases/download/v$(curl/MainTestFile.jar                                                                                                           0.3s
 => CACHED [2/3] RUN mkdir -p /home/app                                                                                                                                                                0.0s
------
 > https://github.com/archu0212/Test/releases/download/v$(curl/MainTestFile.jar:

Any help would be appreciated. Stuck on this for a week.

  • 1
    Don't post text as images. Copy-paste the text into the question with proper formatting. – super Jul 21 '21 at 15:41
  • the result of ```curl -s https://api.github.com/repos/SAMPLE_ORG_NAME/Test/releases/latest | grep "tag_name" | cut -d'v' -f2 | cut -d'"' -f1``` is empty so the next command dont properly worked – alirezadp10 Jul 21 '21 at 15:45
  • Thank you, I have added the error to the text. – Arzu Goyal Jul 21 '21 at 15:46
  • @alirezadp10 When I ran the curl command in terminal I got the right output plus I have now added the actual org_name now – Arzu Goyal Jul 21 '21 at 15:51
  • If you fixed it then please answer your own post. – Antebios Jul 21 '21 at 17:18
  • Related question with proper answer to be found here: https://stackoverflow.com/questions/24987542/is-there-a-link-to-github-for-downloading-a-file-in-the-latest-release-of-a-repo – Herman Cordes Aug 24 '23 at 06:48

0 Answers0