]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
shrink instructions to reduce layers build 1945/head
authorduhow <contacto@duhowpi.net>
Mon, 16 Dec 2024 14:33:19 +0000 (15:33 +0100)
committerduhow <contacto@duhowpi.net>
Mon, 16 Dec 2024 14:33:19 +0000 (15:33 +0100)
docker/Dockerfile

index 4a60294175f93ba1198c6c1e8a487b5d1369861b..21d6790dc53b87051f2342469d5952ced1994a96 100644 (file)
@@ -67,6 +67,28 @@ RUN DESTDIR=install make install
 WORKDIR /
 ##### SPS END #####
 
+##### STATIC FILES #####
+FROM scratch AS files
+
+# Add run script that will start SPS
+COPY --chmod=755 ./docker/run.sh ./run.sh
+COPY ./docker/etc/s6-overlay/s6-rc.d /etc/s6-overlay/s6-rc.d
+COPY ./docker/etc/pulse /etc/pulse
+##### END STATIC FILES #####
+
+##### BUILD FILES #####
+FROM scratch AS build-files
+
+COPY --from=shairport-sync /shairport-sync/build/install/usr/local/bin/shairport-sync /usr/local/bin/shairport-sync
+COPY --from=shairport-sync /shairport-sync/build/install/usr/local/share/man/man1 /usr/share/man/man1
+COPY --from=nqptp /nqptp/nqptp /usr/local/bin/nqptp
+COPY --from=alac /usr/local/lib/libalac.* /usr/local/lib/
+COPY --from=shairport-sync /shairport-sync/build/install/etc/shairport-sync.conf /etc/
+COPY --from=shairport-sync /shairport-sync/build/install/etc/shairport-sync.conf.sample /etc/
+COPY --from=shairport-sync /shairport-sync/build/install/etc/dbus-1/system.d/shairport-sync-dbus.conf /etc/dbus-1/system.d/
+COPY --from=shairport-sync /shairport-sync/build/install/etc/dbus-1/system.d/shairport-sync-mpris.conf /etc/dbus-1/system.d/
+##### END BUILD FILES #####
+
 # Shairport Sync Runtime System
 FROM crazymax/alpine-s6:3.17-3.1.1.2
 
@@ -95,39 +117,23 @@ RUN apk -U add \
         mandoc \
         mosquitto \
         popt \
-        soxr
+        soxr && \
+    rm -rfv /lib/apk/db/* && \
+    rm -rfv /etc/avahi/services/*.service && \
+    addgroup shairport-sync && \
+    adduser -D shairport-sync -G shairport-sync && \
+    addgroup -g 29 docker_audio && \
+    addgroup shairport-sync docker_audio && \
+    addgroup shairport-sync audio
 
-# Copy build files.
-COPY --from=shairport-sync /shairport-sync/build/install/usr/local/bin/shairport-sync /usr/local/bin/shairport-sync
-COPY --from=shairport-sync /shairport-sync/build/install/usr/local/share/man/man1 /usr/share/man/man1
-COPY --from=nqptp /nqptp/nqptp /usr/local/bin/nqptp
-COPY --from=alac /usr/local/lib/libalac.* /usr/local/lib/
-COPY --from=shairport-sync /shairport-sync/build/install/etc/shairport-sync.conf /etc/
-COPY --from=shairport-sync /shairport-sync/build/install/etc/shairport-sync.conf.sample /etc/
-COPY --from=shairport-sync /shairport-sync/build/install/etc/dbus-1/system.d/shairport-sync-dbus.conf /etc/dbus-1/system.d/
-COPY --from=shairport-sync /shairport-sync/build/install/etc/dbus-1/system.d/shairport-sync-mpris.conf /etc/dbus-1/system.d/
-
-COPY ./docker/etc/s6-overlay/s6-rc.d /etc/s6-overlay/s6-rc.d
-COPY ./docker/etc/pulse /etc/pulse
-RUN chmod +x /etc/s6-overlay/s6-rc.d/01-startup/script.sh
+# Remove anything we don't need.
+# Remove any statically-defined Avahi services, e.g. SSH and SFTP
 
 # Create non-root user for running the container -- running as the user 'shairport-sync' also allows
 # Shairport Sync to provide the D-Bus and MPRIS interfaces within the container
-
-RUN addgroup shairport-sync
-RUN adduser -D shairport-sync -G shairport-sync
-
 # Add the shairport-sync user to the pre-existing audio group, which has ID 29, for access to the ALSA stuff
-RUN addgroup -g 29 docker_audio && addgroup shairport-sync docker_audio && addgroup shairport-sync audio
-
-# Remove anything we don't need.
-RUN rm -rf /lib/apk/db/*
-
-# Remove any statically-defined Avahi services, e.g. SSH and SFTP
-RUN rm -rf /etc/avahi/services/*.service
 
-# Add run script that will start SPS
-COPY ./docker/run.sh ./run.sh
-RUN chmod +x /run.sh
+COPY --from=files / /
+COPY --from=build-files / /
 
 ENTRYPOINT ["/init","./run.sh"]