Skip to content

Commit 5c634e1

Browse files
authored
258 maintenance update build strategy (#259)
* [Maintenance] Update build strategy #258 * using libfmt9
1 parent 6070b9d commit 5c634e1

File tree

6 files changed

+178
-22
lines changed

6 files changed

+178
-22
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: Publish multi-arch debian-based Docker images
2+
3+
on:
4+
push:
5+
tags:
6+
- "release/*"
7+
- "main/*"
8+
- "devel/*"
9+
- "feature/*"
10+
- "daily/*"
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
base: ["bullseye", "bookworm"]
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- name: Prepare for docker build
24+
run: |
25+
ref_type=${{ github.ref_type }}
26+
echo "REF_TYPE: ["$ref_type"]"
27+
28+
ref_name=${{ github.ref_name }}
29+
echo "REF_NAME: ["$ref_name"]"
30+
31+
ref=${{ github.ref }}
32+
echo "REF: ["$ref"]"
33+
34+
distro_id=${{ matrix.base }}
35+
image_name=${{secrets.DOCKER_USERNAME}}/mpd-alsa
36+
37+
declare -A mpd_compiler_base_images
38+
mpd_compiler_base_images[bullseye]="giof71/mpd-compiler:bullseye"
39+
mpd_compiler_base_images[bookworm]="giof71/mpd-compiler:bookworm"
40+
41+
select_compiler_image=${mpd_compiler_base_images[${{ matrix.base }}]}
42+
43+
declare -A libfmt_dict
44+
libfmt_dict[bullseye]=libfmt7
45+
libfmt_dict[bookworm]=libfmt9
46+
47+
select_libfmt_package_name=${libfmt_dict[${{ matrix.base }}]}
48+
49+
declare -A base_image_from_matrix
50+
base_image_from_matrix[bookworm]=debian:bookworm-slim
51+
base_image_from_matrix[bullseye]=debian:bullseye-slim
52+
base_image_from_matrix[buster]=debian:buster-slim
53+
54+
declare -A special_tags
55+
special_tags[bullseye]="${image_name}:stable,${image_name}:latest"
56+
special_tags[bookworm]="${image_name}:edge"
57+
special_tags[buster]="${image_name}:legacy,${image_name}:old-stable"
58+
59+
base_image=${base_image_from_matrix[${{ matrix.base }}]}
60+
61+
# mpd version is 0.23.12 (compiled)
62+
mpd_version=0.23.12
63+
64+
tags=""
65+
if [ "${ref_type}" = "branch" ]; then
66+
echo "branch mode";
67+
if [ "${ref_name}" = "main" ]; then
68+
echo "main branch";
69+
tags="${image_name}:main-${distro_id}";
70+
tags="$tags,${image_name}:main-${distro_id}-${mpd_version}";
71+
elif [ "${ref_name}" = "devel" ]; then
72+
echo "devel branch";
73+
tags="${image_name}:devel-${distro_id}-${mpd_version}"
74+
else
75+
echo "other branch ["${ref_name}"]";
76+
tags="${image_name}:branch-${ref_name}-${distro_id}-${mpd_version}";
77+
fi
78+
elif [ "${ref_type}" = "tag" ]; then
79+
echo "tag mode";
80+
echo "tag is ["${ref_name}"]";
81+
82+
tag_type=$(echo ${ref_name} | cut -d '/' -f 1)
83+
tag_name=$(echo ${ref_name} | cut -d '/' -f 2)
84+
85+
if [ "${tag_type}" = "release" ]; then
86+
echo "release tag";
87+
echo "Building now: ["$distro_id"]";
88+
tags="${tags},$image_name:${distro_id}";
89+
tags="${tags},$image_name:${distro_id}-${mpd_version}"
90+
tags="$tags,$image_name:${distro_id}-${mpd_version}-${tag_name}"
91+
select_special_tags=${special_tags["${distro_id}"]};
92+
if [[ -n "${select_special_tags}" ]]; then
93+
echo "Found special tags for ["${distro_id}"]=["${select_special_tags}"]";
94+
tags="$tags,${select_special_tags}";
95+
else
96+
echo "No special tag found for ["${distro_id}"]";
97+
fi
98+
elif [ "${tag_type}" = "main" ]; then
99+
echo "main tag";
100+
tags="${image_name}:main-${tag_name}-${distro_id}-${mpd_version}";
101+
elif [ "${tag_type}" = "devel" ]; then
102+
echo "devel tag";
103+
tags="${image_name}:devel-${tag_name}-${distro_id}-${mpd_version}";
104+
elif [ "${tag_type}" = "feature" ]; then
105+
echo "feature tag";
106+
tags="${image_name}:feature-${tag_name}-${distro_id}-${mpd_version}";
107+
elif [ "${tag_type}" = "daily" ]; then
108+
echo "daily build";
109+
tags="${tags},${image_name}:daily-${distro_id}";
110+
tags="${tags},${image_name}:daily-${distro_id}-${mpd_version}";
111+
fi
112+
fi
113+
echo "Building tags: ["${tags}"]"
114+
echo "RELEASE_TAGS=${tags}" >> $GITHUB_ENV
115+
echo "BASE_IMAGE=${select_compiler_image}" >> $GITHUB_ENV
116+
echo "INTEGER_UPSAMPLING_SUPPORT=yes" >> $GITHUB_ENV
117+
echo "LIBFMT_PACKAGE_NAME=${select_libfmt_package_name}" >> $GITHUB_ENV
118+
119+
- name: Set up QEMU
120+
uses: docker/setup-qemu-action@v2
121+
with:
122+
platforms: all
123+
124+
- name: Set up Docker Buildx
125+
id: buildx
126+
uses: docker/setup-buildx-action@v2
127+
128+
- name: Login to DockerHub
129+
uses: docker/login-action@v2
130+
with:
131+
username: ${{ secrets.DOCKER_USERNAME }}
132+
password: ${{ secrets.DOCKER_PASSWORD }}
133+
134+
- name: Build and push
135+
uses: docker/build-push-action@v3
136+
with:
137+
context: .
138+
build-args: |
139+
BASE_IMAGE=${{ env.BASE_IMAGE }}
140+
INTEGER_UPSAMPLING_SUPPORT=${{ env.INTEGER_UPSAMPLING_SUPPORT }}
141+
LIBFMT_PACKAGE_NAME=${{ env.LIBFMT_PACKAGE_NAME }}
142+
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8
143+
push: true
144+
tags: ${{ env.RELEASE_TAGS }}

.github/workflows/docker-multi-arch.yml renamed to .github/workflows/docker-ubuntu-multi-arch.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish multi-arch Docker images
1+
name: Publish multi-arch ubuntu-based Docker images
22

33
on:
44
push:
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
base: ["bullseye", "jammy", "kinetic"]
18+
base: ["jammy", "kinetic"]
1919

2020
steps:
2121
- name: Checkout
@@ -49,22 +49,16 @@ jobs:
4949
select_libfmt_package_name=${libfmt_dict[${{ matrix.base }}]}
5050
5151
declare -A base_image_from_matrix
52-
base_image_from_matrix[bookworm]=debian:bookworm-slim
53-
base_image_from_matrix[buster]=debian:buster-slim
54-
base_image_from_matrix[bullseye]=debian:bullseye-slim
5552
base_image_from_matrix[bionic]=ubuntu:bionic
5653
base_image_from_matrix[focal]=ubuntu:focal
5754
base_image_from_matrix[jammy]=ubuntu:jammy
5855
base_image_from_matrix[kinetic]=ubuntu:kinetic
5956
6057
declare -A special_tags
61-
special_tags[bullseye]="${image_name}:stable"
62-
special_tags[bookworm]="${image_name}:edge"
63-
special_tags[buster]="${image_name}:legacy,${image_name}:old-stable"
6458
special_tags[bionic]="${image_name}:ubuntu-old-lts"
6559
special_tags[focal]="${image_name}:ubuntu-previous-lts"
6660
special_tags[jammy]="${image_name}:ubuntu-current-lts"
67-
special_tags[kinetic]="${image_name}:ubuntu-current,${image_name}:latest"
61+
special_tags[kinetic]="${image_name}:ubuntu-current"
6862
6963
base_image=${base_image_from_matrix[${{ matrix.base }}]}
7064

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ RUN echo "USE_APT_PROXY=["${USE_APT_PROXY}"]"
1111
RUN echo "INTEGER_UPSAMPLING_SUPPORT=["${INTEGER_UPSAMPLING_SUPPORT}"]"
1212
RUN echo "LIBFMT_PACKAGE_NAME=["${LIBFMT_PACKAGE_NAME}"]"
1313

14-
RUN echo $INTEGER_UPSAMPLING_SUPPORT > /app/conf/integer_upsampling_support.txt
15-
1614
COPY app/conf/01-apt-proxy /app/conf/
1715

1816
RUN if [ "${USE_APT_PROXY}" = "Y" ]; then \
@@ -25,13 +23,19 @@ RUN if [ "${USE_APT_PROXY}" = "Y" ]; then \
2523

2624
ARG DEBIAN_FRONTEND=noninteractive
2725
RUN apt-get update
28-
RUN apt-get upgrade -y
26+
#RUN apt-get upgrade -y
27+
28+
# upstream mpd is installed anyway
2929
RUN apt-get install -y mpd
30+
31+
# required libraries: we are installing these for support of
32+
# the build scenario when base image is not giof71/mpd-compiler
3033
RUN apt-get install -y --no-install-recommends alsa-utils
31-
RUN apt-get install -y --no-install-recommends libasound2-plugin-equal
3234
RUN apt-get install -y --no-install-recommends pulseaudio-utils
35+
RUN apt-get install -y --no-install-recommends libasound2-plugin-equal
3336
RUN apt-get install -y --no-install-recommends mpdscribble
34-
RUN apt-get install -y --no-install-recommends $LIBFMT_PACKAGE_NAME
37+
38+
RUN if [ -n "$LIBFMT_PACKAGE_NAME" ]; then apt-get install -y --no-install-recommends $LIBFMT_PACKAGE_NAME; fi
3539
RUN apt-get install -y --no-install-recommends libsidplay2
3640
RUN apt-get install -y --no-install-recommends libsidutils0
3741
RUN apt-get install -y --no-install-recommends libresid-builder-dev

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Also, thanks to a [feature request](https://github.com/GioF71/mpd-alsa-docker/is
1111
- linux/amd64
1212
- linux/arm/v7
1313
- linux/arm64/v8
14+
- linux/arm/v6 (for debian-based builds)
1415

1516
## References
1617

@@ -39,9 +40,10 @@ The `mpdscribble` version depends on the base image. See the following table:
3940

4041
Base Distro|Tags|MPD Version|MPDScribble Version
4142
:---|:---|:---|:---
42-
debian bullseye|**stable**, bullseye|0.23.12|0.22-6
43-
ubuntu jammy|jammy, ubuntu-current-lts|0.23.12|0.23.1
44-
ubuntu kinetic|**latest**, kinetic, ubuntu-current|0.23.12|0.24.2
43+
debian bullseye|**latest**,**stable**, bullseye|0.23.12|0.24-2
44+
debian bookworm|**edge**, bookworm|0.23.12|0.22-6
45+
ubuntu jammy|jammy, ubuntu-current-lts|0.23.12|0.23-1
46+
ubuntu kinetic|kinetic, ubuntu-current|0.23.12|0.24-2
4547

4648
## Why
4749

build.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,33 @@
66

77
declare -A base_image_tags
88

9+
base_image_tags[local-bullseye]=giof71/mpd-compiler:local-bullseye
10+
base_image_tags[local-bookworm]=giof71/mpd-compiler:local-bookworm
11+
base_image_tags[local-jammy]=giof71/mpd-compiler:local-jammy
12+
base_image_tags[local-kinetic]=giof71/mpd-compiler:local-kinetic
913
base_image_tags[bullseye]=giof71/mpd-compiler:bullseye
14+
base_image_tags[bookworm]=giof71/mpd-compiler:bookworm
1015
base_image_tags[jammy]=giof71/mpd-compiler:jammy
1116
base_image_tags[kinetic]=giof71/mpd-compiler:kinetic
1217

1318
declare -A integer_upsampling_support_dict
19+
integer_upsampling_support_dict[local-bookworm]=yes
20+
integer_upsampling_support_dict[local-bullseye]=yes
21+
integer_upsampling_support_dict[local-jammy]=yes
22+
integer_upsampling_support_dict[local-kinetic]=yes
23+
integer_upsampling_support_dict[bookworm]=yes
1424
integer_upsampling_support_dict[bullseye]=yes
1525
integer_upsampling_support_dict[jammy]=yes
1626
integer_upsampling_support_dict[kinetic]=yes
1727

1828
declare -A libfmt_dict
29+
libfmt_dict[local-bullseye]=libfmt7
1930
libfmt_dict[bullseye]=libfmt7
20-
libfmt_dict[jammy]=libfmt-dev
21-
libfmt_dict[kinetic]=libfmt-dev
31+
libfmt_dict[local-bookworm]=libfmt7
32+
libfmt_dict[bookworm]=libfmt7
2233

2334
DEFAULT_BASE_IMAGE=bullseye
24-
DEFAULT_TAG=local
35+
DEFAULT_TAG=local-bullseye
2536
DEFAULT_USE_PROXY=N
2637

2738
tag=$DEFAULT_TAG
@@ -58,8 +69,8 @@ fi
5869

5970
libfmt_package_name=${libfmt_dict[$base_image_tag]}
6071
if [ -z "${libfmt_package_name}" ]; then
61-
echo "LibFmt package table entry missing for ["${base_image_tag}"]"
62-
exit 2
72+
echo "LibFmt package table entry missing for ["${base_image_tag}"], probably not needed"
73+
#exit 2
6374
fi
6475

6576

doc/change-history.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Date|Major Changes
44
:---|:---
5+
2023-03-24|Add armv6 support on debian-based images (see issue [#258](https://github.com/GioF71/mpd-alsa-docker/issues/258))
56
2023-03-20|Missing libaudiofile-dev (see issue [#253](https://github.com/GioF71/mpd-alsa-docker/issues/253) issue)
67
2023-03-20|Fixed build base image (see issue [#251](https://github.com/GioF71/mpd-alsa-docker/issues/251) issue)
78
2023-03-06|Mentioning mpdscribble version in `README.doc`

0 commit comments

Comments
 (0)