Skip to content

Commit

Permalink
feat(feishin): add initial image version
Browse files Browse the repository at this point in the history
  • Loading branch information
f-bn committed Jan 4, 2025
1 parent cbe50bf commit e7b33bc
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-feishin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Build Feishin image
on:
push:
branches:
- main
paths:
- 'feishin/**'
- '!feishin/README.md'
- '.github/workflows/build-feishin.yml'
workflow_dispatch:
schedule:
- cron: '35 4 * * 6' # Every Saturday at 04:35am
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
version: ['0.12.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: ./feishin
file: ./feishin/Dockerfile
push: true
build-args: |
VERSION=${{ matrix.version }}
tags: |
ghcr.io/f-bn/feishin:${{ matrix.version }}
ghcr.io/f-bn/feishin:latest
37 changes: 37 additions & 0 deletions feishin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# --- Build stage ---
FROM docker.io/node:18-bookworm-slim AS build

ARG VERSION="0.12.1"

WORKDIR /build

ADD https://github.com/jeffvli/feishin.git#v${VERSION} /build

RUN npm install --legacy-peer-deps --ignore-scripts
RUN npm run build:web

# --- Final stage ---
FROM docker.io/nginx:1.27-bookworm

WORKDIR /app

COPY --from=build --chown=nginx:nginx /build/release/app/dist/web /app/
COPY --chown=0:0 settings.js.template /etc/nginx/templates/settings.js.template
COPY --chown=0:0 nginx.conf.template /etc/nginx/templates/default.conf.template

ENV FEISHIN_SERVER_TYPE=""
ENV FEISHIN_SERVER_NAME=""
ENV FEISHIN_SERVER_URL=""
ENV FEISHIN_SERVER_LOCK="false"
ENV FEISHIN_LISTEN_ADDR="0.0.0.0"
ENV FEISHIN_LISTEN_PORT=9180
ENV FEISHIN_PUBLIC_PATH="/"

EXPOSE 9180/tcp

LABEL \
org.opencontainers.image.title="feishin" \
org.opencontainers.image.source="https://github.com/f-bn/containers-images/feishin" \
org.opencontainers.image.description="A modern self-hosted music player" \
org.opencontainers.image.licenses="GPL-3.0-or-later" \
org.opencontainers.image.authors="Florian Bobin <[email protected]>"
23 changes: 23 additions & 0 deletions feishin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## General informations

Custom Feishin image built from sources and allowing some specific nginx configurations.

Built with NodeJS 18 and nginx 1.27.

## Feishin configuration

Feishin can be configured using the following environment variables:

* **Feishin web server configurations**

- `FEISHIN_LISTEN_ADDR`: Feishin web server listen address
- `FEISHIN_LISTEN_PORT`: Feishin web server listen port
- `FEISHIN_PUBLIC_PATH`: Feishin web server public path

* **Feishin backend server configurations**

- `FEISHIN_SERVER_TYPE`: backend server type (can be: `navidrome`, `jellyfin` or `subsonic`)
- `FEISHIN_SERVER_NAME`: backend server name
- `FEISHIN_SERVER_URL`: backend server URL (e.g `https://music.example.com`)
- `FEISHIN_SERVER_LOCK`: if set to `true` AND type, name and URL configurations are set, Feishin can only be configured to connect to a single backend server

27 changes: 27 additions & 0 deletions feishin/nginx.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
server {
listen ${FEISHIN_LISTEN_ADDR}:${FEISHIN_LISTEN_PORT};
sendfile on;
default_type application/octet-stream;

gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 3;

location ${FEISHIN_PUBLIC_PATH} {
alias /app/;
try_files $uri $uri/ /index.html =404;
}

location ${FEISHIN_PUBLIC_PATH}settings.js {
alias /etc/nginx/conf.d/settings.js;
}

location ${FEISHIN_PUBLIC_PATH}/settings.js {
alias /etc/nginx/conf.d/settings.js;
}
}
5 changes: 5 additions & 0 deletions feishin/settings.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";
window.SERVER_URL="${FEISHIN_SERVER_URL}";
window.SERVER_NAME="${FEISHIN_SERVER_NAME}";
window.SERVER_TYPE="${FEISHIN_SERVER_TYPE}";
window.SERVER_LOCK=${FEISHIN_SERVER_LOCK};

0 comments on commit e7b33bc

Please sign in to comment.