Skip to content

Commit c0e97ba

Browse files
committed
fix: improved build time and image size for Kodi
1 parent 3d8fb9c commit c0e97ba

File tree

2 files changed

+70
-28
lines changed

2 files changed

+70
-28
lines changed

images/kodi/Dockerfile

+69-27
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
ARG BASE_APP_IMAGE
1+
ARG KODI_VERSION=21.2-Omega
2+
ARG KODI_INSTALLATION_FOLDER=/kodi
3+
ARG BASE_APP_IMAGE=ghcr.io/games-on-whales/base-app:edge
24

3-
# hadolint ignore=DL3006
4-
FROM ${BASE_APP_IMAGE}
5+
FROM ubuntu:24.10 AS kodi-builder
56

67
ARG DEBIAN_FRONTEND=noninteractive
78

8-
# TODO: Build this madness in a multi-step Dockerfile and just copy the needed binary
9-
# Required packages are listed here:
10-
# - https://github.com/xbmc/xbmc/blob/master/docs/README.Ubuntu.md#32-get-build-dependencies-manually
11-
ARG REQUIRED_PACKAGES=" \
9+
ARG DEV_PACKAGES=" \
1210
debhelper autoconf autoconf automake \
1311
autopoint gettext autotools-dev cmake \
1412
curl default-jre doxygen gawk gcc gdc \
@@ -26,7 +24,7 @@ ARG REQUIRED_PACKAGES=" \
2624
libgpg-error-dev libgtest-dev libiso9660-dev \
2725
libjpeg-dev liblcms2-dev libltdl-dev liblzo2-dev \
2826
libmicrohttpd-dev libmysqlclient-dev libnfs-dev \
29-
libogg-dev libpcre2-dev libplist-dev libpng-dev \
27+
libogg-dev libpcre3-dev libplist-dev libpng-dev \
3028
libpulse-dev libshairplay-dev libsmbclient-dev \
3129
libspdlog-dev libsqlite3-dev libssl-dev libtag1-dev \
3230
libtiff5-dev libtinyxml-dev libtinyxml2-dev libtool \
@@ -39,26 +37,66 @@ ARG REQUIRED_PACKAGES=" \
3937
libxkbcommon-dev waylandpp-dev wayland-protocols \
4038
"
4139

42-
# Build Kodi from source
43-
RUN apt-get update && \
44-
apt-get install -y $REQUIRED_PACKAGES && \
45-
git clone https://github.com/xbmc/xbmc kodi && \
46-
apt-get update && \
47-
mkdir kodi-build && \
48-
cd kodi-build && \
49-
cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=wayland -DAPP_RENDER_SYSTEM=gl && \
50-
cmake --build . -- VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN) && \
51-
make install
52-
53-
# Build controller addon; !!! Add needed Addons HERE !!!
54-
RUN cd kodi && \
55-
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons PREFIX=/usr/local && \
56-
#clean up
57-
cd .. && \
58-
rm -R kodi/ && \
59-
rm -R kodi-build/ && \
60-
apt-get autoremove -y --purge
40+
RUN apt-get update -y && \
41+
apt-get install -y \
42+
$DEV_PACKAGES && \
43+
rm -rf /var/lib/apt/lists/*
44+
45+
ARG KODI_VERSION
46+
ARG KODI_INSTALLATION_FOLDER
47+
48+
RUN <<_BUILD_KODI
49+
50+
mkdir ${KODI_INSTALLATION_FOLDER}
51+
52+
git clone https://github.com/xbmc/xbmc xbmc
53+
echo "Checking out Kodi version: ${KODI_VERSION}"
54+
cd xbmc && git checkout ${KODI_VERSION}
55+
mkdir build && cd build
56+
57+
cmake ../ -DCMAKE_INSTALL_PREFIX=${KODI_INSTALLATION_FOLDER} -DCORE_PLATFORM_NAME=wayland -DAPP_RENDER_SYSTEM=gl -GNinja
58+
cmake --build . -j$(getconf _NPROCESSORS_ONLN)
59+
make -j$(getconf _NPROCESSORS_ONLN) -C ../tools/depends/target/binary-addons PREFIX=${KODI_INSTALLATION_FOLDER} \
60+
ADDONS="peripheral.joystick pvr.*"
6161

62+
cmake --install .
63+
exit 0 # TODO: the install step seems to fail, but the binaries are there...
64+
_BUILD_KODI
65+
66+
# hadolint ignore=DL3006
67+
FROM ${BASE_APP_IMAGE}
68+
69+
ARG REQUIRED_PACKAGES=" \
70+
libasound2-dev libass-dev \
71+
libavahi-client3 libavahi-common3 \
72+
libbluetooth3 libbluray2 bzip2 \
73+
libcdio19t64 libp8-platform2 libcrossguid0 \
74+
libcurl4t64 libcwiid1t64 libdbus-1-3 \
75+
libdrm2 libegl1 libenca0 \
76+
libexiv2-27 libflac12t64 libfmt9 \
77+
libfontconfig1 libfreetype6 \
78+
libfribidi0 libfstrcmp0 \
79+
libgcrypt20 libgif7 libgles2 \
80+
libgl1 libglu1 libgnutls30t64 \
81+
libgpg-error0 libiso9660-11t64 \
82+
libjpeg62 liblcms2-2 libltdl7 liblzo2-2 \
83+
libmicrohttpd12t64 libmysqlclient21 libnfs14 \
84+
libogg0 libpcre3 libplist-2.0-4 libpng16-16t64 \
85+
libpulse0 libshairplay0 libsmbclient0 \
86+
libspdlog1.12 libsqlite3-0 libssl3t64 libtag1v5 \
87+
libtiff6 libtinyxml2-10 libtinyxml2.6.2v5 libtool \
88+
libudev1 libunistring5 libva-dev libvdpau1 \
89+
libvorbis0a libxmu6 libxrandr2 libxslt1.1 \
90+
libxt6t64 lsb-release nasm \
91+
unzip uuid zip zlib1g \
92+
libflatbuffers23.5.26 libglew2.2 libwayland-client0 \
93+
libwayland-client++1 libwayland-cursor++1 libwayland-egl++1 libxkbcommon-x11-0 wayland-protocols \
94+
"
95+
96+
RUN apt-get update -y && \
97+
apt-get install -y --no-install-recommends \
98+
$REQUIRED_PACKAGES && \
99+
rm -rf /var/lib/apt/lists/*
62100

63101
COPY --chmod=777 scripts/startup.sh /opt/gow/startup-app.sh
64102
COPY --chmod=777 scripts/startup-10-create-dirs.sh /opt/gow/startup.d/10-create-dirs.sh
@@ -67,6 +105,10 @@ COPY configs/Switch_controller.xml /opt/gow/Switch_controller.xml
67105
COPY configs/PS_controller.xml /opt/gow/PS_controller.xml
68106
COPY configs/settings.xml /opt/gow/settings.xml
69107

108+
ARG KODI_INSTALLATION_FOLDER
109+
COPY --chmod=777 --from=kodi-builder $KODI_INSTALLATION_FOLDER $KODI_INSTALLATION_FOLDER
110+
RUN ln -s $KODI_INSTALLATION_FOLDER/bin/kodi /usr/bin/kodi
111+
70112
ENV XDG_RUNTIME_DIR=/tmp/.X11-unix
71113

72114
ARG IMAGE_SOURCE

images/kodi/scripts/startup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ done
1414
gow_log "Starting Kodi"
1515

1616
source /opt/gow/launch-comp.sh
17-
launcher kodi
17+
launcher KODI_HOME=$HOME kodi
1818
#launcher jstest-gtk

0 commit comments

Comments
 (0)