Skip to content

Commit cd3e30b

Browse files
authored
#462 build from source code (#463)
1 parent ca1ccaf commit cd3e30b

14 files changed

+127
-215
lines changed

.github/workflows/docker-multi-arch.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
base: [ "noble" ]
18+
base: [ "stable" ]
1919
build_mode: ["full", "renderer"]
2020

2121
steps:
@@ -41,6 +41,7 @@ jobs:
4141
base_images[kinetic]=ubuntu:kinetic
4242
base_images[jammy]=ubuntu:jammy
4343
base_images[bookworm]=debian:bookworm-slim
44+
base_images[stable]=debian:stable-slim
4445
4546
image_name="${{secrets.DOCKER_USERNAME}}/upmpdcli"
4647
@@ -114,7 +115,7 @@ jobs:
114115
fi
115116
echo "Building tags: ["${tags}"]"
116117
echo "RELEASE_TAGS=${tags}" >> $GITHUB_OUTPUT
117-
echo "BASE_IMAGE=${select_base_image}" >> $GITHUB_OUTPUT
118+
echo "USE_BASE_IMAGE=${select_base_image}" >> $GITHUB_OUTPUT
118119
119120
- name: Set up QEMU
120121
uses: docker/setup-qemu-action@v3
@@ -137,7 +138,7 @@ jobs:
137138
context: .
138139
build-args: |
139140
USE_APT_PROXY=N
140-
BASE_IMAGE=${{ steps.prepare.outputs.BASE_IMAGE }}
141+
USE_BASE_IMAGE=${{ steps.prepare.outputs.USE_BASE_IMAGE }}
141142
BUILD_MODE=${{ matrix.build_mode }}
142143
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
143144
push: true

Dockerfile

+61-68
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,70 @@
1-
ARG BASE_IMAGE="${BASE_IMAGE:-ubuntu:noble}"
1+
ARG BASE_IMAGE="${BASE_IMAGE:-debian:stable-slim}"
22
FROM ${BASE_IMAGE} AS base
3-
ARG BASE_IMAGE="${BASE_IMAGE:-ubuntu:noble}"
4-
ARG BUILD_MODE="${BUILD_MODE:-full}"
5-
ARG USE_APT_PROXY
6-
7-
RUN mkdir -p /app/conf
8-
RUN mkdir -p /app/install
9-
10-
COPY app/conf/01proxy /app/conf/
11-
12-
RUN if [ "$USE_APT_PROXY" = "Y" ]; then \
13-
echo "Using apt proxy"; \
14-
cp /app/conf/01proxy /etc/apt/apt.conf.d/01proxy; \
15-
echo /etc/apt/apt.conf.d/01proxy; \
16-
else \
17-
echo "Building without proxy"; \
18-
fi
193

204
ARG DEBIAN_FRONTEND=noninteractive
21-
225
RUN apt-get update
23-
RUN apt-get install -y ca-certificates
24-
25-
RUN if [ "$BUILD_MODE" = "full" ]; then \
26-
apt-get install -y python3 python3-pip; \
27-
fi
28-
29-
COPY app/install/* /app/install/
30-
RUN chmod u+x /app/install/*.sh
31-
RUN /app/install/setup.sh
32-
33-
RUN apt-get install -y upmpdcli
34-
RUN apt-get install -y --no-install-recommends iproute2 grep
35-
36-
RUN if [ "$BUILD_MODE" = "full" ]; then \
37-
apt-get install -y \
38-
upmpdcli-bbc \
39-
upmpdcli-hra \
40-
upmpdcli-qobuz \
41-
upmpdcli-radio-browser \
42-
upmpdcli-radio-paradise \
43-
upmpdcli-mother-earth-radio \
44-
upmpdcli-radios \
45-
upmpdcli-subsonic \
46-
upmpdcli-tidal \
47-
upmpdcli-uprcl; \
48-
fi
49-
50-
RUN if [ "$BUILD_MODE" = "full" ]; then \
51-
apt-get install -y \
52-
recollcmd; \
53-
fi
54-
55-
RUN if [ "$BUILD_MODE" = "full" ]; then \
56-
apt-get install -y exiftool; \
57-
fi
58-
59-
RUN if [ "$BUILD_MODE" = "full" ]; then \
60-
apt-get install -y git; \
61-
fi
62-
63-
RUN apt-get install -y net-tools
646

7+
RUN apt-get -y install \
8+
ca-certificates \
9+
bash \
10+
curl \
11+
net-tools \
12+
iproute2 \
13+
grep \
14+
git \
15+
build-essential \
16+
meson \
17+
pkg-config \
18+
cmake \
19+
libexpat1-dev \
20+
libmicrohttpd-dev \
21+
libjsoncpp-dev \
22+
libmpdclient-dev
23+
24+
# create build directory
25+
WORKDIR /build
26+
27+
# build npupnp
28+
RUN git clone https://framagit.org/medoc92/npupnp.git
29+
WORKDIR /build/npupnp
30+
RUN meson setup --prefix /usr build
31+
WORKDIR /build/npupnp/build
32+
RUN ninja
33+
RUN meson install
34+
35+
# build libupnpp
36+
WORKDIR /build
37+
RUN git clone https://framagit.org/medoc92/libupnpp.git
38+
WORKDIR /build/libupnpp
39+
RUN meson setup --prefix /usr build
40+
WORKDIR /build/libupnpp/build
41+
RUN ninja
42+
RUN meson install
43+
44+
# build upmpdcli
45+
ARG BRANCH_NAME=upmpdcli-v1.9.3
46+
RUN echo "Using branch [${BRANCH_NAME}}] for upmpdcli ..."
47+
WORKDIR /build
48+
RUN git clone --depth 1 --branch ${BRANCH_NAME} https://framagit.org/medoc92/upmpdcli.git
49+
50+
WORKDIR /build/upmpdcli
51+
RUN meson setup --prefix /usr build
52+
WORKDIR /build/upmpdcli/build
53+
RUN ninja
54+
RUN meson install
55+
56+
ARG BUILD_MODE=full
57+
58+
WORKDIR /install
59+
COPY app/install/* /install/
60+
RUN chmod +x /install/*.sh
61+
RUN if [ "${BUILD_MODE}" = "full" ]; then /bin/sh -c /install/mediaserver-libraries.sh; fi
62+
RUN if [ "${BUILD_MODE}" = "full" ]; then /bin/sh -c /install/mediaserver-python-packages.sh; fi
63+
64+
RUN apt-get -y remove pkg-config meson cmake build-essential libexpat1-dev
6565
RUN apt-get -y autoremove
66-
RUN rm -rf /var/lib/apt/lists/*
67-
68-
RUN if [ "$USE_APT_PROXY" = "Y" ]; then \
69-
rm /etc/apt/apt.conf.d/01proxy; \
70-
fi
71-
72-
RUN rm -Rf /app/install
73-
74-
RUN echo $BUILD_MODE > /app/conf/build_mode.txt
66+
RUN rm -Rf /var/lib/apt/lists/*
67+
RUN rm -Rf /build
7568

7669
FROM scratch
7770
COPY --from=base / /

app/bin/run-upmpdcli.sh

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# 2 Invalid RENDERER_MODE value
66
# 3 Invalid argument
77

8+
# display upmpdcli version.
9+
upmpdcli -v
10+
811
USER_CONF_PATH=/user/config
912

1013
current_user_id=$(id -u)

app/conf/01proxy

-2
This file was deleted.

app/install/mediaserver-libraries.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
echo "BUILD_MODE=[${BUILD_MODE}]"
6+
7+
if [ "${BUILD_MODE}" = "full" ]; then
8+
apt-get -y install curl
9+
apt-get -y install python3
10+
apt-get -y install exiftool
11+
apt-get -y install recoll recollcmd python3-recoll python3-mutagen python3-waitress python3-bottle sqlite3
12+
apt-get -y install python3-pip
13+
fi
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
echo "BUILD_MODE=[${BUILD_MODE}]"
6+
7+
if [ "${BUILD_MODE}" = "full" ]; then
8+
pip install --break-system-packages subsonic-connector
9+
pip install --break-system-packages tidalapi
10+
pip install --break-system-packages pyradios
11+
fi

app/install/setup-debian.sh

-41
This file was deleted.

app/install/setup-ubuntu.sh

-19
This file was deleted.

app/install/setup.sh

-57
This file was deleted.

app/install/ubuntu.upnpp1.list

-2
This file was deleted.

0 commit comments

Comments
 (0)