Skip to content

Commit

Permalink
Fix arm-only image build issue #436 (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
GioF71 authored Aug 24, 2024
1 parent 55673b7 commit 50adfa1
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 28 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ARG BASE_IMAGE="${BASE_IMAGE:-ubuntu:noble}"
FROM ${BASE_IMAGE} AS base
ARG BASE_IMAGE="${BASE_IMAGE:-ubuntu:noble}"
ARG USE_PPA="${USE_PPA:-upnpp1}"
ARG BUILD_MODE="${BUILD_MODE:-full}"
ARG USE_APT_PROXY

Expand All @@ -20,8 +19,10 @@ RUN if [ "$USE_APT_PROXY" = "Y" ]; then \

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get install -y ca-certificates

RUN if [ "$BUILD_MODE" = "full" ]; then \
apt-get update; \
apt-get install -y python3 python3-pip; \
fi

Expand Down Expand Up @@ -61,8 +62,6 @@ RUN if [ "$BUILD_MODE" = "full" ]; then \

RUN apt-get install -y net-tools

RUN apt-get remove -y software-properties-common

RUN apt-get -y autoremove
RUN rm -rf /var/lib/apt/lists/*

Expand Down
17 changes: 12 additions & 5 deletions app/install/setup-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

set -ex

echo $USE_PPA > /app/conf/ppa.txt
PPA_NAME=upnpp1
PPA_KEY=bd1ec68cab92bbd56698f1c507971a38c8a2ca38

echo $PPA_NAME > /app/conf/ppa.txt

apt-get update
apt-get install -y git
apt-get install -y software-properties-common
add-apt-repository ppa:jean-francois-dockes/${USE_PPA}
apt-get update
apt-get install -y gnupg

mkdir -p /etc/apt/sources.list.d -p
cp /app/install/ubuntu.${PPA_NAME}.list /etc/apt/sources.list.d/${PPA_NAME}.list
# cat /etc/apt/sources.list.d/${PPA_NAME}.list
sed -i "s/UBUNTU_VERSION/${IMAGE_VERSION}/g" /etc/apt/sources.list.d/${PPA_NAME}.list
# cat /etc/apt/sources.list.d/${PPA_NAME}.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${PPA_KEY}
apt-get update
24 changes: 14 additions & 10 deletions app/install/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,26 @@ IMAGE_VERSION=$(echo $BASE_IMAGE | cut -d ":" -f 2)
echo "IMAGE_VERSION=[$IMAGE_VERSION]"

apt-get update

if [[ "$BASE_IMAGE" == ubuntu* ]]; then
echo "Setup for ubuntu"
. /app/install/setup-ubuntu.sh
elif [[ "$BASE_IMAGE" == debian* ]]; then
echo "Setup for debian"
. /app/install/setup-debian.sh
else
echo "BASE_IMAGE=[${BASE_IMAGE}] is not supported."
exit 1
fi

apt-get install -y git

if [ "$BUILD_MODE" = "full" ]; then
if [[ "$BUILD_MODE" == "full" ]]; then
declare -A needs_switch
needs_switch[bookworm-slim]=1
needs_switch[mantic]=1
needs_switch[noble]=1
needs_switch[oracular]=1
add_switch=0
if [[ -v needs_switch[$IMAGE_VERSION] ]]; then
add_switch=${needs_switch[$IMAGE_VERSION]}
Expand Down Expand Up @@ -42,12 +55,3 @@ if [ "$BUILD_MODE" = "full" ]; then
done
fi

if [[ "$BASE_IMAGE" == ubuntu* ]]; then
echo "Setup for ubuntu"
/app/install/setup-ubuntu.sh
elif [[ "$BASE_IMAGE" == debian* ]]; then
echo "Setup for debian"
/app/install/setup-debian.sh
else
exit 1
fi
2 changes: 2 additions & 0 deletions app/install/ubuntu.upnpp1.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deb https://ppa.launchpadcontent.net/jean-francois-dockes/upnpp1/ubuntu UBUNTU_VERSION main
deb-src https://ppa.launchpadcontent.net/jean-francois-dockes/upnpp1/ubuntu UBUNTU_VERSION main
10 changes: 2 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,19 @@ base_images[focal]=ubuntu:focal
DEFAULT_BASE_IMAGE=noble
DEFAULT_TAG=local
DEFAULT_USE_PROXY=N
DEFAULT_PPA=upnpp1
DEFAULT_BUILD_MODE=full

DEFAULT_CACHE_MODE=""

tag=$DEFAULT_TAG
use_proxy=$DEFAULT_USE_PROXY

ppa=$DEFAULT_PPA

while getopts b:t:p:e:m:c: flag
while getopts b:t:p:m:c: flag
do
case "${flag}" in
b) base_image=${OPTARG};;
t) tag=${OPTARG};;
p) proxy=${OPTARG};;
e) ppa=${OPTARG};;
m) build_mode=${OPTARG};;
c) cache_mode=${OPTARG};;
esac
Expand All @@ -39,7 +35,6 @@ done
echo "base_image: $base_image";
echo "tag: $tag";
echo "proxy: $proxy";
echo "ppa: $ppa";
echo "build_mode: $build_mode";
echo "cache_mode: $cache_mode";

Expand Down Expand Up @@ -70,15 +65,14 @@ fi

echo "Base Image: ["$select_base_image"]"
echo "Tag: ["$tag"]"
echo "PPA: ["$ppa"]"
echo "Build Mode: ["$build_mode"]"
echo "Proxy: ["$use_proxy"]"

cmd_line="docker build . ${cache_mode} \
--build-arg BASE_IMAGE=${select_base_image} \
--build-arg USE_APT_PROXY=${use_proxy} \
--build-arg USE_PPA=${ppa} \
--build-arg BUILD_MODE=${build_mode} \
--progress=plain \
-t giof71/upmpdcli:$tag"

echo "cmd_line=[$cmd_line]"
Expand Down
3 changes: 2 additions & 1 deletion doc/change-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

Change Date|Major Changes
---|---
2024-07-21|Add support for disabling OpenHome Radio Service (see issue [#429](https://github.com/GioF71/upmpdcli-docker/issues/429))
2024-08-24|Fix arm-only image build issue (see issue [#436](https://github.com/GioF71/upmpdcli-docker/issues/436))
2024-08-21|Bump to upmpdcli version 1.8.6
2024-07-19|Add `SKIP_CHOWN_CACHE` to skip chown on possibly crowded /cache
2024-07-12|Add script for generating tidal oauth2 credentials (see issue [#425](https://github.com/GioF71/upmpdcli-docker/issues/425))
2024-06-13|Automatically set ohproductroom to friendlyname if not explicitly set
Expand Down

0 comments on commit 50adfa1

Please sign in to comment.