this post was submitted on 02 Jun 2024
3 points (66.7% liked)

Docker

39 readers
1 users here now

Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.

founded 1 year ago
MODERATORS
 

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

I ask because I've just seen these errors

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

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

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 2 points 5 months ago (1 children)

I took the dockerfile from https://github.com/linuxserver/docker-headphones/blob/master/Dockerfile

Updated it to look like

# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine:3.20

# set version label
ARG BUILD_DATE
ARG VERSION
ARG HEADPHONES_COMMIT
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="aptalca"
# hard set UTC in case the user does not define it
ENV TZ="Etc/UTC"

# copy patches folder
COPY patches/ /tmp/patches/

RUN \
  echo "**** install build packages ****" && \
  apk add --no-cache --virtual=build-dependencies \
    build-base && \
  echo "**** install runtime packages ****" && \
  apk add --no-cache \
    ffmpeg \
    flac \
    mc \
    python3 && \
  echo "**** compile shntool *** *" && \
  mkdir -p \
    /tmp/shntool && \
  tar xf /tmp/patches/shntool-3.0.10.tar.gz -C \
    /tmp/shntool --strip-components=1 && \
  cp /tmp/patches/config.* /tmp/shntool && \
  cd /tmp/shntool && \
  ./configure \
    --infodir=/usr/share/info \
    --localstatedir=/var \
    --mandir=/usr/share/man \
    --prefix=/usr \
    --sysconfdir=/etc && \
  make && \
  make install && \
  echo "**** install headphones ****" && \
  mkdir -p /app/headphones && \
  if [ -z ${HEADPHONES_COMMIT+x} ] ; then \
    HEADPHONES_COMMIT=$(curl -sX GET "https://api.github.com/repos/rembo10/headphones/commits/master" \
    | jq -r .sha); \
  fi && \
  curl -o \
    /tmp/headphones.tar.gz -sL \
    "https://github.com/rembo10/headphones/archive/${HEADPHONES_COMMIT}.tar.gz" && \
  tar xf \
    /tmp/headphones.tar.gz -C \
    /app/headphones --strip-components=1 && \
  echo ${HEADPHONES_COMMIT} > /app/headphones/version.txt && \
  echo "**** cleanup ****" && \
  apk del --purge \
    build-dependencies && \
  rm -rf \
    /tmp/* \
    /usr/lib/*.la

# add local files
COPY root/ /

# ports and volumes
EXPOSE 8181
VOLUME /config

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

And expected it to work ๐Ÿซฃ

[โ€“] CameronDev 3 points 5 months ago (1 children)

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.

[โ€“] [email protected] 2 points 5 months ago

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