Is this a stupid question?

Was I supposed to clone the GitHub repository before trying to build the image?

I ask because I’ve just seen these errors


<span style="color:#323232;"> => ERROR [2/4] COPY patches/ /tmp/patches/                                0.0s
</span><span style="color:#323232;"> => CACHED [3/4] RUN   echo "**** install build packages ****" &&   apk a  0.0s
</span><span style="color:#323232;"> => ERROR [4/4] COPY root/ /                                               0.0s
</span><span style="color:#323232;">------
</span><span style="color:#323232;"> > [2/4] COPY patches/ /tmp/patches/:
</span><span style="color:#323232;">------
</span><span style="color:#323232;">------
</span><span style="color:#323232;"> > [4/4] COPY root/ /:
</span><span style="color:#323232;">------
</span><span style="color:#323232;">Dockerfile:63
</span><span style="color:#323232;">--------------------
</span><span style="color:#323232;">  61 |     
</span><span style="color:#323232;">  62 |     # add local files
</span><span style="color:#323232;">  63 | >>> COPY root/ /
</span><span style="color:#323232;">  64 |     
</span><span style="color:#323232;">  65 |     # ports and volumes
</span><span style="color:#323232;">--------------------
</span><span style="color:#323232;">ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 2ad57b92-028a-429f-a2de-be0e9a7f57af::cz3t2511b10hmumww1m73cse6: "/root": not found
</span><span style="color:#323232;">
</span>

And being as n00b as I am, I’m instantly trying to attribute the blame to me not doing something.

CameronDev,

Did you just download a Dockerfile? Link to the repo, but I suspect you are correct and you need to clone and build from the clone.

sabreW4K3,
@sabreW4K3@lazysoci.al avatar

I took the dockerfile from github.com/linuxserver/…/Dockerfile

Updated it to look like


<span style="color:#323232;"># syntax=docker/dockerfile:1
</span><span style="color:#323232;">
</span><span style="color:#323232;">FROM ghcr.io/linuxserver/baseimage-alpine:3.20
</span><span style="color:#323232;">
</span><span style="color:#323232;"># set version label
</span><span style="color:#323232;">ARG BUILD_DATE
</span><span style="color:#323232;">ARG VERSION
</span><span style="color:#323232;">ARG HEADPHONES_COMMIT
</span><span style="color:#323232;">LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
</span><span style="color:#323232;">LABEL maintainer="aptalca"
</span><span style="color:#323232;"># hard set UTC in case the user does not define it
</span><span style="color:#323232;">ENV TZ="Etc/UTC"
</span><span style="color:#323232;">
</span><span style="color:#323232;"># copy patches folder
</span><span style="color:#323232;">COPY patches/ /tmp/patches/
</span><span style="color:#323232;">
</span><span style="color:#323232;">RUN 
</span><span style="color:#323232;">  echo "**** install build packages ****" && 
</span><span style="color:#323232;">  apk add --no-cache --virtual=build-dependencies 
</span><span style="color:#323232;">    build-base && 
</span><span style="color:#323232;">  echo "**** install runtime packages ****" && 
</span><span style="color:#323232;">  apk add --no-cache 
</span><span style="color:#323232;">    ffmpeg 
</span><span style="color:#323232;">    flac 
</span><span style="color:#323232;">    mc 
</span><span style="color:#323232;">    python3 && 
</span><span style="color:#323232;">  echo "**** compile shntool *** *" && 
</span><span style="color:#323232;">  mkdir -p 
</span><span style="color:#323232;">    /tmp/shntool && 
</span><span style="color:#323232;">  tar xf /tmp/patches/shntool-3.0.10.tar.gz -C 
</span><span style="color:#323232;">    /tmp/shntool --strip-components=1 && 
</span><span style="color:#323232;">  cp /tmp/patches/config.* /tmp/shntool && 
</span><span style="color:#323232;">  cd /tmp/shntool && 
</span><span style="color:#323232;">  ./configure 
</span><span style="color:#323232;">    --infodir=/usr/share/info 
</span><span style="color:#323232;">    --localstatedir=/var 
</span><span style="color:#323232;">    --mandir=/usr/share/man 
</span><span style="color:#323232;">    --prefix=/usr 
</span><span style="color:#323232;">    --sysconfdir=/etc && 
</span><span style="color:#323232;">  make && 
</span><span style="color:#323232;">  make install && 
</span><span style="color:#323232;">  echo "**** install headphones ****" && 
</span><span style="color:#323232;">  mkdir -p /app/headphones && 
</span><span style="color:#323232;">  if [ -z ${HEADPHONES_COMMIT+x} ] ; then 
</span><span style="color:#323232;">    HEADPHONES_COMMIT=$(curl -sX GET "https://api.github.com/repos/rembo10/headphones/commits/master" 
</span><span style="color:#323232;">    | jq -r .sha); 
</span><span style="color:#323232;">  fi && 
</span><span style="color:#323232;">  curl -o 
</span><span style="color:#323232;">    /tmp/headphones.tar.gz -sL 
</span><span style="color:#323232;">    "https://github.com/rembo10/headphones/archive/${HEADPHONES_COMMIT}.tar.gz" && 
</span><span style="color:#323232;">  tar xf 
</span><span style="color:#323232;">    /tmp/headphones.tar.gz -C 
</span><span style="color:#323232;">    /app/headphones --strip-components=1 && 
</span><span style="color:#323232;">  echo ${HEADPHONES_COMMIT} > /app/headphones/version.txt && 
</span><span style="color:#323232;">  echo "**** cleanup ****" && 
</span><span style="color:#323232;">  apk del --purge 
</span><span style="color:#323232;">    build-dependencies && 
</span><span style="color:#323232;">  rm -rf 
</span><span style="color:#323232;">    /tmp/* 
</span><span style="color:#323232;">    /usr/lib/*.la
</span><span style="color:#323232;">
</span><span style="color:#323232;"># add local files
</span><span style="color:#323232;">COPY root/ /
</span><span style="color:#323232;">
</span><span style="color:#323232;"># ports and volumes
</span><span style="color:#323232;">EXPOSE 8181
</span><span style="color:#323232;">VOLUME /config
</span>

Saved it and ran docker build -t headphones /headphones/

And expected it to work 🫣

CameronDev,

Yup, youll need the patches and root folders alongside the dockerfile at a minimum. Those COPY lines expect them. Clone is the way to go.

sabreW4K3,
@sabreW4K3@lazysoci.al avatar

Thank you so much. Waking up to this is chef’s kiss. Thank you again!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • docker@selfhosted.forum
  • fightinggames
  • All magazines