Skip to content

Commit

Permalink
Merge pull request #879 from jaedb/develop
Browse files Browse the repository at this point in the history
3.66
  • Loading branch information
jaedb authored Jan 14, 2023
2 parents 737b774 + 58f487c commit 83b0332
Show file tree
Hide file tree
Showing 19 changed files with 438 additions and 605 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,22 @@ jobs:
name: 'Publish: DockerHub'
runs-on: ubuntu-latest
needs: [jest, tox]
if: github.event_name == 'release'
if: github.event_name == 'release' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Generating tags and labels
id: meta
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Generating release tags and labels
if: github.event_name == 'release'
id: release_meta
uses: docker/metadata-action@v4
with:
images: jaedb/iris
Expand All @@ -145,6 +151,14 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Generating edge branch labels
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
id: edge_meta
uses: docker/metadata-action@v4
with:
images: jaedb/iris
tags: ${{ steps.extract_branch.outputs.branch }}

- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand All @@ -155,5 +169,5 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.release_meta.outputs.tags || steps.edge_meta.outputs.tags }}
labels: ${{ steps.release_meta.outputs.labels || steps.edge_meta.outputs.tags }}
70 changes: 0 additions & 70 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14
165 changes: 128 additions & 37 deletions Dockerfile
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,80 +1,171 @@
FROM debian:buster
# --- Build Node ---
FROM rust:slim-bullseye AS Builder
LABEL org.opencontainers.image.authors="https://github.com/seppi91"
ARG TARGETPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT

# Print Info about current build Target
RUN printf "I'm building for TARGETPLATFORM=${TARGETPLATFORM}" \
&& printf ", TARGETARCH=${TARGETARCH}" \
&& printf ", TARGETVARIANT=${TARGETVARIANT} \n" \
&& printf "With uname -s : " && uname -s \
&& printf "and uname -m : " && uname -mm

# Switch to the root user while we do our changes
USER root

# Install all libraries and needs
RUN apt update \
&& apt install -yq --no-install-recommends \
git \
patch \
libgstreamer-plugins-base1.0-dev \
libgstreamer1.0-dev \
libcsound64-dev \
libclang-11-dev \
libpango1.0-dev \
libdav1d-dev \
# libgtk-4-dev \ Only in bookworm
&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/gst-plugins-rs

# Clone source of gst-plugins-rs to workdir
ARG GST_PLUGINS_RS_TAG=main
RUN git clone -c advice.detachedHead=false \
--single-branch --depth 1 \
--branch ${GST_PLUGINS_RS_TAG} \
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git ./
# EXPERIMENTAL: For gstreamer-spotify set upgraded version number of dependency librespot to 0.4.2
RUN sed -i 's/librespot = { version = "0.4", default-features = false }/librespot = { version = "0.4.2", default-features = false }/g' audio/spotify/Cargo.toml

# Build GStreamer plugins written in Rust (optional with --no-default-features)
ENV DEST_DIR /target/gst-plugins-rs
ENV CARGO_PROFILE_RELEASE_DEBUG false
RUN export CSOUND_LIB_DIR="/usr/lib/$(uname -m)-linux-gnu" \
&& export PLUGINS_DIR=$(pkg-config --variable=pluginsdir gstreamer-1.0) \
&& export SO_SUFFIX=so \
&& cargo build --release --no-default-features \
# List of packages to build
--package gst-plugin-spotify \
# Use install command to create directory (-d), copy and print filenames (-v), and set attributes/permissions (-m)
&& install -v -d ${DEST_DIR}/${PLUGINS_DIR} \
&& install -v -m 755 target/release/*.${SO_SUFFIX} ${DEST_DIR}/${PLUGINS_DIR}


# --- Release Node ---
FROM debian:bullseye-slim as Release

# Switch to the root user while we do our changes
USER root
WORKDIR /

# Install GStreamer and other required Debian packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
&& apt-get install -y --no-install-recommends \
sudo \
build-essential \
curl \
git \
wget \
gnupg2 \
git \
python3-setuptools \
python3-pip \
dumb-init \
graphviz-dev \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \
gstreamer1.0-pulseaudio \
pulseaudio \
libasound2-dev \
python3-dev \
python3-gst-1.0 \
build-essential \
libdbus-glib-1-dev \
libgirepository1.0-dev \
dleyna-server \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Install Python
python3-dev \
python3-gst-1.0 \
python3-setuptools \
python3-pip \
# GStreamer (Plugins)
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
gstreamer1.0-pulseaudio \
&& rm -rf /var/lib/apt/lists/*

# Copy builded target data from Builder DEST_DIR to root
# Note: target directory tree links directly to $GST_PLUGIN_PATH
COPY --from=Builder /target/gst-plugins-rs/ /

# Install Node, to build Iris JS application
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs

# Install libspotify-dev from apt.mopidy.com
# Install mopidy and (optional) DLNA-server dleyna from apt.mopidy.com
# see https://docs.mopidy.com/en/latest/installation/debian/
RUN mkdir -p /usr/local/share/keyrings \
&& wget -q -O /usr/local/share/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg \
&& wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list \
&& apt-get update \
&& apt-get install -y libspotify-dev mopidy-spotify \
&& rm -rf /var/lib/apt/lists/*
&& wget -q -O /usr/local/share/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg \
&& wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list \
&& apt-get update \
&& apt-get install -y \
mopidy \
&& rm -rf /var/lib/apt/lists/*

# Upgrade Python package manager pip
# https://pypi.org/project/pip/
RUN python3 -m pip install --upgrade pip

# Clone Iris from the repository and install in development mode.
# This allows a binding at "/iris" to map to your local folder for development, rather than
# installing using pip.
# Note using ADD helps prevent caching issues. When HEAD changes, our cache is invalidated, whee!
# Note: ADD helps prevent RUN caching issues. When HEAD changes in repo, our cache will be invalidated!
ADD https://api.github.com/repos/jaedb/Iris/git/refs/heads/master version.json
RUN git clone --depth 1 -b master https://github.com/jaedb/Iris.git /iris \
ENV IRIS_VERSION=develop
RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/jaedb/Iris.git /iris \
&& cd /iris \
&& npm install \
&& npm run prod \
&& python3 setup.py develop \
&& mkdir -p /var/lib/mopidy/.config \
&& ln -s /config /var/lib/mopidy/.config/mopidy \
# Allow mopidy user to run system commands (restart, local scan, etc)
&& echo "mopidy ALL=NOPASSWD: /iris/mopidy_iris/system.sh" >> /etc/sudoers
&& echo "mopidy ALL=NOPASSWD: /iris/mopidy_iris/system.sh" >> /etc/sudoers \
# Enable container mode (disable restart option, etc.)
&& echo "1" >> /IS_CONTAINER \
# Copy Version file
&& cp /iris/VERSION /

# Install mopidy-spotify-gstspotify (Hack, not released yet!)
# (https://github.com/kingosticks/mopidy-spotify/tree/gstspotifysrc-hack)
RUN git clone --depth 1 -b gstspotifysrc-hack https://github.com/kingosticks/mopidy-spotify.git mopidy-spotify \
&& cd mopidy-spotify \
&& python3 setup.py install \
&& cd .. \
&& rm -rf mopidy-spotify

# Install additional Python dependencies
RUN python3 -m pip install --no-cache \
tox \
mopidy-mpd \
mopidy-local
# Install additional mopidy extensions and Python dependencies via pip
COPY docker/requirements.txt .
RUN python3 -m pip install -r requirements.txt

# Cleanup
RUN apt-get clean all \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.cache \
&& rm -rf /iris/node_modules

# Start helper script.
COPY docker/entrypoint.sh /entrypoint.sh

# Default configuration.
# Copy Default configuration for mopidy
COPY docker/mopidy/mopidy.example.conf /config/mopidy.conf

# Copy the pulse-client configuratrion.
# Copy the pulse-client configuratrion
COPY docker/mopidy/pulse-client.conf /etc/pulse/client.conf

# Add version info to image
COPY VERSION /

# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID.
# RUN useradd -ms /bin/bash mopidy
ENV HOME=/var/lib/mopidy
RUN set -ex \
&& usermod -G audio,sudo mopidy \
&& usermod -G audio,sudo,pulse-access mopidy \
&& mkdir /var/lib/mopidy/local \
&& chown mopidy:audio -R $HOME /entrypoint.sh /iris \
&& chmod go+rwx -R $HOME /entrypoint.sh /iris \
&& echo "1" >> /IS_CONTAINER
&& chmod go+rwx -R $HOME /entrypoint.sh /iris

# Runs as mopidy user by default.
USER mopidy:audio
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ recursive-exclude src *
recursive-exclude docker *
exclude .jshintrc
exclude .babelrc
exclude jest.config.js
exclude jest.config.js
exclude .nvmrc
1 change: 1 addition & 0 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
- 6600:6600
- 6680:6680
volumes:
# - ./mopidy/iris:/iris/mopidy/iris # To use a locally-built UI
- ./docker/mopidy/iris:/var/lib/mopidy/iris # Iris-specific storage
- ./docker/mopidy/m3u:/var/lib/mopidy/m3u # To persist local playlists
- ./docker/mopidy/mopidy.conf:/config/mopidy.conf
Expand Down
9 changes: 9 additions & 0 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Mopidy-Local
Mopidy-Mpd
Mopidy-MusicBox-Webclient
Mopidy-Soundcloud
Mopidy-Youtube
Mopidy-YTMusic
ytmusicapi
youtube_dl
tox
4 changes: 2 additions & 2 deletions src/js/components/GridItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const GridItem = ({
dispatch(spotifyActions.getArtistImages(item));
}
break;
// case 'playlist':
case 'playlist':
case 'album':
dispatch(mopidyActions.getImages([item.uri]));
break;
Expand All @@ -122,7 +122,7 @@ const GridItem = ({
to = `/${item.type}/${encodeUri(item.uri)}`;
if (item.name && item.type !== 'artist') {
// Strip out "%"; this causes conflicts with our uri decoder
to += `/${encodeURIComponent(item.name.replace('%', ''))}`;
to += `/${encodeURIComponent(item.name.replace('%', '').replace('/', ''))}`;
}
}

Expand Down
Loading

0 comments on commit 83b0332

Please sign in to comment.