Skip to content

Commit

Permalink
feat(navidrome): add image
Browse files Browse the repository at this point in the history
  • Loading branch information
f-bn committed Apr 13, 2024
1 parent 37b9b15 commit f3c0497
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build-navidrome.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This repository contains my personal custom OCI containers images.
#### Images

- [ferretdb](./ferretdb/)
- [navidrome](./navidrome/) (`amd64` only)
- [pgbouncer](./pgbouncer/)
- [postgresql](./postgresql/)

Expand All @@ -19,6 +20,7 @@ docker pull ghcr.io/f-bn/<image>:<tag>
### 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
88 changes: 88 additions & 0 deletions navidrome/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
22 changes: 22 additions & 0 deletions navidrome/README.md
Original file line number Diff line number Diff line change
@@ -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/).

0 comments on commit f3c0497

Please sign in to comment.