navidrome/Dockerfile

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.9 KiB
Docker
Raw Normal View History

2020-01-23 01:42:56 +01:00
#####################################################
### Build UI bundles
FROM node:13-alpine AS jsbuilder
2020-01-23 01:42:56 +01:00
WORKDIR /src
COPY ui/package.json ui/package-lock.json ./
RUN npm ci
COPY ui/ .
RUN npm run build
#####################################################
### Build executable
2020-02-26 15:37:48 +01:00
FROM golang:1.14-alpine AS gobuilder
2020-01-23 01:42:56 +01:00
# Download build tools
RUN mkdir -p /src/ui/build
RUN apk add -U --no-cache build-base git
RUN go get -u github.com/go-bindata/go-bindata/...
# Download project dependencies
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
2020-01-29 23:09:46 +01:00
# Copy source, test it
2020-01-23 01:42:56 +01:00
COPY . .
2020-01-29 23:09:46 +01:00
RUN go test ./...
# Copy UI bundle, build executable
2020-01-23 01:42:56 +01:00
COPY --from=jsbuilder /src/build/* /src/ui/build/
COPY --from=jsbuilder /src/build/static/css/* /src/ui/build/static/css/
COPY --from=jsbuilder /src/build/static/js/* /src/ui/build/static/js/
RUN rm -rf /src/build/css /src/build/js
RUN GIT_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) && \
GIT_TAG=${GIT_TAG#"tags/"} && \
GIT_SHA=$(git rev-parse --short HEAD) && \
echo "Building version: ${GIT_TAG} (${GIT_SHA})" && \
go-bindata -fs -prefix ui/build -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/... && \
go build -ldflags="-X github.com/deluan/navidrome/consts.gitSha=${GIT_SHA} -X github.com/deluan/navidrome/consts.gitTag=${GIT_TAG}" -tags=embed
2020-01-23 01:42:56 +01:00
#####################################################
### Build Final Image
2020-01-28 21:01:23 +01:00
FROM alpine as release
LABEL maintainer="deluan@navidrome.org"
2020-01-24 01:44:08 +01:00
COPY --from=gobuilder /src/navidrome /app/
2020-01-23 01:42:56 +01:00
# Install ffmpeg and output build config
RUN apk add --no-cache ffmpeg
2020-01-28 21:01:23 +01:00
RUN ffmpeg -buildconf
2020-01-23 01:42:56 +01:00
VOLUME ["/data", "/music"]
2020-01-24 07:29:31 +01:00
ENV ND_MUSICFOLDER /music
ENV ND_DATAFOLDER /data
ENV ND_SCANINTERVAL 1m
2020-03-26 20:15:40 +01:00
ENV ND_TRANSCODINGCACHESIZE 100MB
ENV ND_SESSIONTIMEOUT 30m
2020-01-24 07:29:31 +01:00
ENV ND_LOGLEVEL info
ENV ND_PORT 4533
2020-01-23 01:42:56 +01:00
2020-03-26 20:15:40 +01:00
EXPOSE ${ND_PORT}
HEALTHCHECK CMD wget -O- http://localhost:${ND_PORT}/ping || exit 1
2020-01-23 01:42:56 +01:00
WORKDIR /app
2020-01-28 21:01:23 +01:00
ENTRYPOINT ["/app/navidrome"]