Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

236 maintenance streamline dockerfile #238

Merged
merged 8 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/docker-multi-arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
base: [ "jammy"]
base: [ "jammy", "lunar", "bookworm"]
build_mode: ["full", "renderer"]

steps:
Expand All @@ -39,7 +39,9 @@ jobs:
base_images[kinetic]=ubuntu:kinetic
base_images[jammy]=ubuntu:jammy
base_images[focal]=ubuntu:focal
base_images[bionic]=ubuntu:bionic
base_images[bookworm]=debian:bookworm-slim
base_images[bullseye]=debian:bullseye-slim
base_images[buster]=debian:buster-slim

image_name="${{secrets.DOCKER_USERNAME}}/upmpdcli"

Expand All @@ -49,8 +51,14 @@ jobs:
echo "Building build_key: ["$build_key"]";

declare -A special_tags
special_tags[jammy-full]="${image_name}:ubuntu-lts,${image_name}:jammy,${image_name}:ubuntu-lts-full,${image_name}:stable,${image_name}:latest,${image_name}:stable-full"
special_tags[jammy-renderer]="${image_name}:ubuntu-lts-renderer,${image_name}:latest-renderer,${image_name}:stable-renderer"
special_tags[jammy-full]="${image_name}:latest,${image_name}:stable,${image_name}:ubuntu-lts-full,${image_name}:stable-full"
special_tags[jammy-renderer]="${image_name}:latest-renderer,${image_name}:stable-renderer,${image_name}:ubuntu-lts-renderer"
special_tags[lunar-full]="${image_name}:ubuntu-current-full"
special_tags[lunar-renderer]="${image_name}:ubuntu-current-renderer"
special_tags[bookworm-full]="${image_name}:debian-stable-full"
special_tags[bookworm-renderer]="${image_name}:debian-stable-renderer"
special_tags[bullseye-full]="${image_name}:debian-oldstable-full"
special_tags[bullseye-renderer]="${image_name}:debian-oldstable-renderer"

base=${{ matrix.base }}
build_mode=${{ matrix.build_mode }}
Expand Down
37 changes: 12 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ RUN if [ "$USE_APT_PROXY" = "Y" ]; then \

ARG DEBIAN_FRONTEND=noninteractive

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

COPY app/install/* /app/install
RUN chmod u+x /app/install/*.sh

RUN /app/install/setup.sh

RUN apt-get install -y upmpdcli
RUN if [ "$BUILD_MODE" = "full" ]; then \
apt-get install -y python3 python3-pip python3-venv; \
fi
RUN if [ "$BUILD_MODE" = "full" ]; then \
apt-get install -y \
upmpdcli-bbc \
Expand All @@ -38,37 +38,25 @@ RUN if [ "$BUILD_MODE" = "full" ]; then \
upmpdcli-qobuz \
upmpdcli-radio-browser \
upmpdcli-radios \
upmpdcli-spotify \
upmpdcli-subsonic \
upmpdcli-uprcl \
recoll \
recollcmd; \
upmpdcli-uprcl; \
fi

RUN if [ "$BUILD_MODE" = "full" ]; then \
apt-get install -y \
upmpdcli-*; \
recollcmd; \
fi

RUN if [ "$BUILD_MODE" = "full" ]; then \
apt-get install -y exiftool; \
fi
RUN if [ "$BUILD_MODE" = "full" ]; then \
apt-get install -y git; \
fi
RUN if [ "$BUILD_MODE" = "full" ]; then \
pip install --upgrade pip; \
fi

RUN if [ "$BUILD_MODE" = "full" ]; then \
pip install pyradios; \
pip install py-sonic; \
pip install subsonic-connector==0.1.17; \
pip install beautifulsoup4; \
pip install python-dateutil; \
pip install feedparser; \
pip install requests; \
pip install mutagen; \
apt-get install -y git; \
fi

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

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

Expand All @@ -77,7 +65,6 @@ RUN if [ "$USE_APT_PROXY" = "Y" ]; then \
fi

RUN echo $BUILD_MODE > /app/conf/build_mode.txt
RUN echo $USE_PPA > /app/conf/ppa.txt

FROM scratch
COPY --from=BASE / /
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ Please find a list of the currently built images in the following table.

Base Image|Build Mode|Tags
:---|:---:|:---
debian:bookworm-slim|full|`stable` `latest` `bookworm` `daily-bookworm`
debian:bookworm-slim|`stable-renderer` `latest-renderer` `bookworm-renderer` `daily-bookworm-renderer`
ubuntu:lunar|full|`ubuntu-current` `lunar` `daily-lunar`
ubuntu:jammy|full|`stable` `latest` `ubuntu-lts-full` `jammy-full` `daily-jammy-full`
ubuntu:jammy|renderer|`stable-renderer` `latest-renderer` `ubuntu-lts-renderer` `jammy-renderer` `daily-jammy-renderer`
ubuntu:lunar|full|`ubuntu-current-full` `lunar-full` `daily-lunar`
ubuntu:lunar|renderer|`ubuntu-current-renderer` `lunar-renderer` `daily-lunar-renderer`
debian:bookworm-slim|full|`bookworm-full` `daily-bookworm`
debian:bookworm-slim|`bookworm-renderer` `daily-bookworm-renderer`

## Usage

Expand Down Expand Up @@ -258,6 +260,7 @@ Just be careful to use the tag you have built.

Change Date|Major Changes
---|---
2023-08-19|Build process cleanup, back to no separate venv (see issue [#236](https://github.com/GioF71/upmpdcli-docker/issues/236))
2023-08-15|Add missing `recoll` package (see issue [#234](https://github.com/GioF71/upmpdcli-docker/issues/234))
2023-07-23|Switch to debian (see issue [#230](https://github.com/GioF71/upmpdcli-docker/issues/230))
2023-07-11|Avoid use of `--break-system-packages` in Dockerfile (see issue [#227](https://github.com/GioF71/upmpdcli-docker/issues/227))
Expand Down
3 changes: 3 additions & 0 deletions app/install/setup-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

set -ex

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

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

29 changes: 29 additions & 0 deletions app/install/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@ set -ex

echo "BASE_IMAGE=[$BASE_IMAGE]"

IMAGE_VERSION=$(echo $BASE_IMAGE | cut -d ":" -f 2)
echo "IMAGE_VERSION=[$IMAGE_VERSION]"

if [ "$BUILD_MODE" = "full" ]; then
declare -A needs_switch
needs_switch[bookworm-slim]=1
needs_switch[lunar]=1
add_switch=0
if [[ -v needs_switch[$IMAGE_VERSION] ]]; then
add_switch=${needs_switch[$IMAGE_VERSION]}
fi
pip_upgrade="pip install --no-cache-dir --upgrade pip"
if [ $add_switch -eq 1 ]; then
pip_upgrade="$pip_upgrade --break-system-packages"
fi
python_packages=(pyradios py-sonic subsonic-connector==0.1.17 mutagen)
for pkg in "${python_packages[@]}"
do
echo "Installing ${pkg} with add_switch [$add_switch]..."
cmd="pip install --no-cache-dir"
if [ $add_switch -eq 1 ]; then
cmd="$cmd --break-system-packages"
fi
cmd="$cmd ${pkg}"
echo "cmd=[$cmd]"
eval "$cmd"
done
fi

if [[ "$BASE_IMAGE" == ubuntu* ]]; then
echo "Setup for ubuntu"
/app/install/setup-ubuntu.sh
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
declare -A base_images

base_images[bookworm]=debian:bookworm-slim
base_images[bullseye]=debian:bullseye-slim
base_images[lunar]=ubuntu:lunar
base_images[kinetic]=ubuntu:kinetic
base_images[jammy]=ubuntu:jammy
base_images[focal]=ubuntu:focal
base_images[bionic]=ubuntu:bionic

DEFAULT_BASE_IMAGE=jammy
DEFAULT_TAG=local
Expand Down