🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Build and release docker images
Deluanf7b3ff4b3459
diff --git a/.dockerignore b/.dockerignoreindex c6b56acf1..445e23cb7 100644--- a/.dockerignore+++ b/.dockerignore@@ -1,6 +1,5 @@.DS_Storeui/node_modules-ui/buildJamstash-masterDockerfiledocker-compose*.ymldiff --git a/.github/workflows/Dockerfile.pipeline b/.github/workflows/Dockerfile.pipelinenew file mode 100644index 000000000..40ac80153--- /dev/null+++ b/.github/workflows/Dockerfile.pipeline@@ -0,0 +1,51 @@+#####################################################+### Build executable+FROM golang:1.14-alpine AS gobuilder++# 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++# Copy source, test it+COPY . .+RUN go test ./...++# Copy UI bundle, build executable+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++#####################################################+### Build Final Image+FROM alpine as release+LABEL maintainer="[email protected]"++COPY --from=gobuilder /src/navidrome /app/++# Install ffmpeg and output build config+RUN apk add --no-cache ffmpeg+RUN ffmpeg -buildconf++VOLUME ["/data", "/music"]+ENV ND_MUSICFOLDER /music+ENV ND_DATAFOLDER /data+ENV ND_SCANINTERVAL 1m+ENV ND_TRANSCODINGCACHESIZE 100MB+ENV ND_SESSIONTIMEOUT 30m+ENV ND_LOGLEVEL info+ENV ND_PORT 4533++EXPOSE ${ND_PORT}+HEALTHCHECK CMD wget -O- http://localhost:${ND_PORT}/ping || exit 1+WORKDIR /app++ENTRYPOINT ["/app/navidrome"]diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 2cf9cc51d..b32e8c5ee 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -97,7 +97,6 @@ jobs:- name: Run GoReleaseruses: docker://deluan/ci-goreleaser:1.14.1-1-env:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}with:diff --git a/.github/workflows/docker-tags.sh b/.github/workflows/docker-tags.shnew file mode 100755index 000000000..5a43b1fb9--- /dev/null+++ b/.github/workflows/docker-tags.sh@@ -0,0 +1,17 @@+#!/bin/bash++GIT_TAG="${GITHUB_REF##refs/tags/}"+GIT_BRANCH="${GITHUB_REF##refs/heads/}"+GIT_SHA=$(git rev-parse --short HEAD)++DOCKER_IMAGE_TAG="--tag ${DOCKER_IMAGE}:sha-${GIT_SHA}"++if [[ $GITHUB_REF != $GIT_TAG ]]; then+ DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:${GIT_TAG#v} --tag ${DOCKER_IMAGE}:latest"+elif [[ $GITHUB_REF == "refs/heads/master" ]]; then+ DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:develop"+elif [[ $GIT_BRANCH = feature/* ]]; then+ DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:$(echo $GIT_BRANCH | tr / -)"+fi++echo ${DOCKER_IMAGE_TAG}\ No newline at end of filediff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 6d21c60a7..1a4bd0da2 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -1,34 +1,91 @@name: Releaseon:push:+ branches:+ - mastertags:- - "*"+ - "v*"jobs:- release:- name: Release+ js:+ name: Build JS bundle+ if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'runs-on: ubuntu-lateststeps:- - name: Checkout Code- uses: actions/checkout@v2- with:- fetch-depth: 0-- - name: Unshallow- run: git fetch --prune --unshallow-+ - uses: actions/checkout@v2- uses: actions/setup-node@v1with:node-version: 13- - name: Build UI+ - uses: actions/cache@v1+ id: cache-npm+ with:+ path: ~/.npm+ key: ${{ runner.os }}-node-${{ hashFiles('ui/package-lock.json') }}+ restore-keys: |+ ${{ runner.os }}-node-++ - name: npm install dependenciesrun: |cd uinpm ci++ - name: npm build+ run: |+ cd uinpm run build+ - uses: actions/upload-artifact@v1+ with:+ name: js-bundle+ path: ui/build++ binaries:+ name: Binaries+ if: startsWith(github.ref, 'refs/tags/')+ needs: [js]+ runs-on: ubuntu-latest+ steps:+ - name: Checkout Code+ uses: actions/checkout@v2++ - name: Unshallow+ run: git fetch --prune --unshallow++ - uses: actions/download-artifact@v1+ with:+ name: js-bundle+ path: ui/build+- name: Run GoReleaseruses: docker://deluan/ci-goreleaser:1.14.1-1env:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}with:args: goreleaser release --rm-dist++ docker:+ name: Docker images+ if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'+ needs: [js]+ runs-on: ubuntu-latest+ steps:+ - name: Set up Docker Buildx+ id: buildx+ uses: crazy-max/ghaction-docker-buildx@v1+ with:+ version: latest++ - uses: actions/checkout@v1++ - uses: actions/download-artifact@v1+ with:+ name: js-bundle+ path: ui/build++ - name: Build the Docker image and push+ env:+ DOCKER_IMAGE: deluan/deluan+ DOCKER_PLATFORM: linux/amd64,linux/arm/v7,linux/arm64+ run: |+ echo ${{secrets.DOCKER_PASSWORD}} | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin+ docker buildx build --platform ${DOCKER_PLATFORM} `.github/workflows/docker-tags.sh` -f .github/workflows/Dockerfile.pipeline --push .diff --git a/.goreleaser.yml b/.goreleaser.ymlindex f763f35ac..47ac03580 100644--- a/.goreleaser.yml+++ b/.goreleaser.yml@@ -143,7 +143,7 @@ release:draft: truechangelog:- sort: asc+ # sort: ascfilters:exclude:- "^docs:"