diff --git a/.github/workflows/build-navidrome.yml b/.github/workflows/build-navidrome.yml new file mode 100644 index 0000000..622e134 --- /dev/null +++ b/.github/workflows/build-navidrome.yml @@ -0,0 +1,44 @@ +--- +name: Build Navidrome image +on: + push: + branches: + - main + paths: + - navidrome/** + - .github/workflows/build-navidrome.yml + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + version: ['0.51.1'] + steps: + - name: Check-out repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push image to registry + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + context: ./navidrome + file: ./navidrome/Dockerfile + push: true + build-args: | + VERSION=${{ matrix.version }} + tags: | + ghcr.io/f-bn/navidrome:${{ matrix.version }} \ No newline at end of file diff --git a/README.md b/README.md index 77758e9..e6ac6b5 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ This repository contains my personal custom OCI containers images. #### Images - [ferretdb](./ferretdb/) +- [navidrome](./navidrome/) (`amd64` only) - [pgbouncer](./pgbouncer/) - [postgresql](./postgresql/) @@ -19,6 +20,7 @@ docker pull ghcr.io/f-bn/: ### References - FerretDB: https://www.ferretdb.com/ +- Navidrome: https://www.navidrome.org/ - PostgreSQL: https://www.postgresql.org/ - pgbouncer: https://www.pgbouncer.org/ - WolfiOS: https://github.com/wolfi-dev diff --git a/navidrome/Dockerfile b/navidrome/Dockerfile new file mode 100644 index 0000000..27bf3fa --- /dev/null +++ b/navidrome/Dockerfile @@ -0,0 +1,88 @@ +# --- Build stage --- +FROM docker.io/gcc:13.2 AS ffmpeg-build + +ARG FFMPEG_VERSION=6.1.1 + +RUN set -ex ; \ + export DEBIAN_FRONTEND=noninteractive ; \ + apt update ; \ + apt install -y --no-install-recommends \ + libmp3lame-dev \ + libopus-dev \ + yasm \ + cmake \ + automake \ + build-essential + +WORKDIR /build + +ADD https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz /build/ + +RUN tar -xf ffmpeg-${FFMPEG_VERSION}.tar.xz --strip-components=1 + +RUN set -ex ; \ + ./configure \ + --prefix=/usr \ + --libdir=/usr/lib \ + --disable-doc \ + --disable-network \ + --disable-autodetect \ + --disable-everything \ + --enable-encoder=libopus,aac \ + --enable-decoder=flac,libopus \ + --enable-parser=flac \ + --enable-muxer=flac,opus,adts \ + --enable-demuxer=flac \ + --enable-filter=aresample \ + --enable-protocol=file,pipe \ + --enable-shared \ + --enable-gpl \ + --enable-libopus ; \ + make -j2 DESTDIR=./dist install + +# --- Build stage --- +FROM cgr.dev/chainguard/wolfi-base:latest AS build + +ARG TARGETOS +ARG TARGETARCH +ARG VERSION=0.51.1 + +WORKDIR /build + +ADD https://github.com/navidrome/navidrome/releases/download/v${VERSION}/navidrome_${VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz /build/ + +RUN tar -xzf /build/navidrome_${VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz + +# --- Final stage --- +FROM cgr.dev/chainguard/wolfi-base:latest + +ARG TARGETOS +ARG TARGETARCH + +COPY --from=ffmpeg-build /build/dist/ / +COPY --from=build /build/navidrome /usr/bin/navidrome + +RUN set -ex ; \ + mkdir -p /etc/navidrome /var/lib/navidrome /media/music ; \ + chown nonroot:nonroot /var/lib/navidrome + +RUN apk add --no-cache opus + +ENV ND_MUSICFOLDER=/media/music +ENV ND_DATAFOLDER=/var/lib/navidrome +ENV ND_CACHEFOLDER=${ND_DATAFOLDER}/cache + +USER nonroot + +EXPOSE 4533/tcp + +VOLUME [ "/var/lib/navidrome" ] + +ENTRYPOINT [ "/usr/bin/navidrome" ] + +LABEL \ + org.opencontainers.image.title="navidrome" \ + org.opencontainers.image.source="https://github.com/f-bn/containers-images/navidrome" \ + org.opencontainers.image.description="Modern Music Server and Streamer compatible with Subsonic/Airsonic" \ + org.opencontainers.image.licenses="GPL-3.0-or-later" \ + org.opencontainers.image.authors="Florian Bobin " \ No newline at end of file diff --git a/navidrome/README.md b/navidrome/README.md new file mode 100644 index 0000000..061abc3 --- /dev/null +++ b/navidrome/README.md @@ -0,0 +1,22 @@ +## General informations + +Custom Navidrome image with a minimal ffpmeg audio-only build. + +### ffmpeg notes + +This image contains a custom ffmpeg **audio-only** build with a limited audio plugins available (video plugins are not needed at all by Navidrome). + +There was two goal to build ffmpeg from sources for Navidrome: + - Keep Navidrome image as minimal as possible since ffmpeg can require a lot of dependencies when compiled with a large set of audio/video plugins (like in standard Linux distributions repositories). + - Support for Opus Audio codec for audio transcoding (since native WolfiOS ffmpeg package is not built with Opus support) + +## Navidrome configuration + +This image doesn't come with a default Navidrome configuration. You can bring your own configuration to the container (e.g using Docker): + +```shell +$ docker run [options] -v navidrome.toml:/etc/navidrome/config.toml \ + ghcr.io/f-bn/navidrome:0.51.0 --configfile /etc/navidrome/config.toml +``` + +More informations about Navidrome configuration [here](https://www.navidrome.org/docs/usage/configuration-options/). \ No newline at end of file