# Stage 1: Get LiteFS binary
FROM flyio/litefs:0.5 AS litefs

# Stage 2: Final image
FROM ghcr.io/navidrome/navidrome:latest

# Install dependencies
USER root
RUN apk add --no-cache fuse3 ca-certificates bash curl jq

# Copy LiteFS binary
COPY --from=litefs /usr/local/bin/litefs /usr/local/bin/litefs

# Copy scripts
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

# Copy LiteFS configuration
COPY litefs.yml /etc/litefs.yml

# LiteFS becomes the supervisor.

# It will mount the FUSE fs and then execute the command defined in litefs.yml's exec section.

ENTRYPOINT ["litefs", "mount"]
