Switch to Debian Bookworm; pull directly from PHP Docker image.

This commit is contained in:
Buster Neece 2024-02-13 06:20:52 -06:00
parent c853f23807
commit df7ca46919
No known key found for this signature in database
14 changed files with 80 additions and 103 deletions

View File

@ -1,7 +1,7 @@
#
# Golang dependencies build step
#
FROM golang:1.21-bullseye AS go-dependencies
FROM golang:1.21-bookworm AS go-dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl git
@ -25,7 +25,7 @@ FROM ghcr.io/azuracast/azuracast.com:builtin AS docs
#
# Icecast-KH with AzuraCast customizations build step
#
FROM ghcr.io/azuracast/icecast-kh-ac:latest AS icecast
FROM ghcr.io/azuracast/icecast-kh-ac:2024-02-13 AS icecast
#
# Roadrunner build step
@ -35,9 +35,16 @@ FROM ghcr.io/roadrunner-server/roadrunner:2023.3.8 AS roadrunner
#
# Final build image
#
FROM ubuntu:jammy AS pre-final
FROM php:8.3-fpm-bookworm AS pre-final
ENV TZ="UTC"
ENV TZ="UTC" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
LANG="en_US.UTF-8" \
LC_TYPE="en_US.UTF-8"
# Add PHP extension installer tool
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
# Add Go dependencies
COPY --from=go-dependencies /go/bin/dockerize /usr/local/bin

View File

@ -9,14 +9,8 @@ export INITRD=no
export DEBIAN_FRONTEND=noninteractive
## Enable Ubuntu Universe, Multiverse, and deb-src for main.
sed -i 's/^#\s*\(deb.*main restricted\)$/\1/g' /etc/apt/sources.list
sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
sed -i 's/^#\s*\(deb.*multiverse\)$/\1/g' /etc/apt/sources.list
# Pick specific Ubuntu mirror
# sed -i 's/archive.ubuntu.com/mirror.genesisadaptive.com/g' /etc/apt/sources.list
# sed -i 's/security.ubuntu.com/mirror.genesisadaptive.com/g' /etc/apt/sources.list
# Enable contrib and nonfree repos
sed -i 's/^Components: main$/& contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources
apt-get update
@ -28,9 +22,6 @@ ln -sf /bin/true /sbin/initctl
# Add default timezone.
echo "UTC" > /etc/timezone
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
sed -i "s/^exit 101$/exit 0/" /usr/sbin/policy-rc.d
## Replace the 'ischroot' tool to make it always return true.
## Prevent initscripts updates from breaking /dev/shm.
## https://journal.paul.querna.org/articles/2013/10/15/docker-ubuntu-on-rackspace/
@ -38,20 +29,19 @@ sed -i "s/^exit 101$/exit 0/" /usr/sbin/policy-rc.d
dpkg-divert --local --rename --add /usr/bin/ischroot
ln -sf /bin/true /usr/bin/ischroot
# apt-utils fix for Ubuntu 16.04
apt-get install -y --no-install-recommends apt-utils
## Install HTTPS support for APT.
apt-get install -y --no-install-recommends apt-transport-https ca-certificates
apt-get install -y --no-install-recommends apt-utils apt-transport-https ca-certificates
## Upgrade all packages.
apt-get dist-upgrade -y --no-install-recommends -o Dpkg::Options::="--force-confold"
## Fix locale.
apt-get install -y --no-install-recommends language-pack-en
apt-get install -y --no-install-recommends locales
locale-gen en_US
update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
dpkg-reconfigure locales
# Make init folders
mkdir -p /etc/my_init.d

View File

@ -1,11 +1,6 @@
#!/bin/bash
source /etc/php/.version
cp /etc/php/${PHP_VERSION}/cli/conf.d/05-azuracast.ini /etc/php/${PHP_VERSION}/fpm/conf.d/05-azuracast.ini
gosu azuracast azuracast_php_startup
# Run PHP-FPM
exec /usr/sbin/php-fpm${PHP_VERSION} -F --fpm-config /etc/php/${PHP_VERSION}/fpm/php-fpm.conf \
-c /etc/php/${PHP_VERSION}/fpm/
exec php-fpm -F --fpm-config /usr/local/etc/php-fpm.conf

View File

@ -2,30 +2,8 @@
set -e
set -x
source /etc/php/.version
# Install dev PHP stuff
apt-get install -y --no-install-recommends php${PHP_VERSION}-fpm php${PHP_VERSION}-xdebug
install-php-extensions xdebug spx
mkdir -p /run/php
touch /run/php/php${PHP_VERSION}-fpm.pid
cp /bd_build/dev/php/www.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
# Install PHP SPX profiler
apt-get install -y --no-install-recommends php${PHP_VERSION}-dev zlib1g-dev build-essential
mkdir -p /bd_build/web/php-spx
cd /bd_build/web/php-spx
git clone https://github.com/NoiseByNorthwest/php-spx.git .
phpize
./configure
make
sudo make install
apt-get remove --purge -y php${PHP_VERSION}-dev zlib1g-dev build-essential
echo "extension=spx.so" > /etc/php/${PHP_VERSION}/mods-available/30-spx.ini
ln -s /etc/php/${PHP_VERSION}/mods-available/30-spx.ini /etc/php/${PHP_VERSION}/cli/conf.d/30-spx.ini
ln -s /etc/php/${PHP_VERSION}/mods-available/30-spx.ini /etc/php/${PHP_VERSION}/fpm/conf.d/30-spx.ini
rm -rf /usr/local/etc/php-fpm.d/*
cp /bd_build/dev/php/www.conf /usr/local/etc/php-fpm.d/www.conf

View File

@ -16,7 +16,15 @@ mysql_note "Initial DB setup..."
mysql_check_config "$@"
# Load various environment variables
docker_setup_env "$@"
docker_create_db_directories
# Create DB directories
mkdir -p "$DATADIR"
if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' +
# See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \;
fi
# If container is started as root user, restart as dedicated mysql user
if [ "$(id -u)" = "0" ]; then

View File

@ -6,3 +6,6 @@ apt-get install -y --no-install-recommends redis-server
cp /bd_build/redis/redis/redis.conf /etc/redis/redis.conf
chown redis:redis /etc/redis/redis.conf
mkdir -p /run/redis
chown redis:redis /run/redis

View File

@ -4,4 +4,4 @@ set -x
# Icecast is built and imported in its own Docker container.
apt-get install -q -y --no-install-recommends libxml2 openssl
apt-get install -q -y --no-install-recommends libxml2 libxslt1.1 openssl

View File

@ -6,9 +6,9 @@ set -x
apt-get install -y --no-install-recommends \
libao4 libfaad2 libfdk-aac2 libgd3 liblo7 libmad0 libmagic1 libportaudio2 \
libsdl2-image-2.0-0 libsdl2-ttf-2.0-0 libsoundtouch1 libxpm4 \
libasound2 libavcodec58 libavdevice58 libavfilter7 libavformat58 libavutil56 \
libpulse0 libsamplerate0 libswresample3 libswscale5 libtag1v5 \
libsrt1.4-openssl bubblewrap ffmpeg liblilv-0-0 libjemalloc2
libasound2 libavcodec59 libavdevice59 libavfilter8 libavformat59 libavutil57 \
libpulse0 libsamplerate0 libswresample4 libswscale6 libtag1v5 \
libsrt1.5-openssl bubblewrap ffmpeg liblilv-0-0 libjemalloc2 libpcre3
# Audio Post-processing
apt-get install -y --no-install-recommends ladspa-sdk
@ -19,7 +19,7 @@ if [[ "$(uname -m)" = "aarch64" ]]; then
ARCHITECTURE=arm64
fi
wget -O /tmp/liquidsoap.deb "https://github.com/savonet/liquidsoap/releases/download/v2.2.4/liquidsoap_2.2.4-ubuntu-jammy-2_${ARCHITECTURE}.deb"
wget -O /tmp/liquidsoap.deb "https://github.com/savonet/liquidsoap/releases/download/v2.2.4/liquidsoap_2.2.4-debian-bookworm-2_${ARCHITECTURE}.deb"
# wget -O /tmp/liquidsoap.deb "https://github.com/savonet/liquidsoap-release-assets/releases/download/rolling-release-v2.2.x/liquidsoap-6721bb1_2.2.4-ubuntu-jammy-1_${ARCHITECTURE}.deb"
dpkg -i /tmp/liquidsoap.deb

View File

@ -3,7 +3,7 @@ set -e
set -x
apt-get install -y --no-install-recommends python3-minimal python3-pip
pip3 install --no-cache-dir setuptools supervisor \
pip3 install --no-cache-dir --break-system-packages setuptools supervisor \
git+https://github.com/coderanger/supervisor-stdout
# apt-get install -y --no-install-recommends supervisor

View File

@ -3,23 +3,6 @@ set -e
set -x
# Group up several package installations here to reduce overall build time
curl -S "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x90908c2298e5d46c2c1b55594c1bcde2763923d8" \
| sudo gpg --batch --yes --dearmor --output "/etc/apt/keyrings/audiowaveform.gpg"
echo "deb [signed-by=/etc/apt/keyrings/audiowaveform.gpg] https://ppa.launchpadcontent.net/chris-needham/ppa/ubuntu jammy main" >> /etc/apt/sources.list.d/audiowaveform.list
echo "deb-src [signed-by=/etc/apt/keyrings/audiowaveform.gpg] https://ppa.launchpadcontent.net/chris-needham/ppa/ubuntu jammy main" >> /etc/apt/sources.list.d/audiowaveform.list
curl -S "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x19f81a792d451fb0c42afb35fb22bf628e6f7e24" \
| sudo gpg --batch --yes --dearmor --output "/etc/apt/keyrings/sftpgo.gpg"
echo "deb [signed-by=/etc/apt/keyrings/sftpgo.gpg] https://ppa.launchpadcontent.net/sftpgo/sftpgo/ubuntu jammy main" >> /etc/apt/sources.list.d/sftpgo.list
echo "deb-src [signed-by=/etc/apt/keyrings/sftpgo.gpg] https://ppa.launchpadcontent.net/sftpgo/sftpgo/ubuntu jammy main" >> /etc/apt/sources.list.d/sftpgo.list
apt-get update
apt-get install -y --no-install-recommends \
audiowaveform=1.10.1-1jammy1 \
nginx-light openssl \
tmpreaper \
zstd \
sftpgo
apt-get install -y --no-install-recommends nginx-light openssl tmpreaper zstd

View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
set -x
# Per-architecture LS installs
ARCHITECTURE=amd64
if [[ "$(uname -m)" = "aarch64" ]]; then
ARCHITECTURE=arm64
fi
apt-get install -y --no-install-recommends \
libid3tag0 libboost-program-options1.74.0 libboost-filesystem1.74.0 libboost-regex1.74.0
wget -O /tmp/audiowaveform.deb "https://github.com/bbc/audiowaveform/releases/download/1.10.1/audiowaveform_1.10.1-1-12_${ARCHITECTURE}.deb"
dpkg -i /tmp/audiowaveform.deb
apt-get install -y -f --no-install-recommends
rm -f /tmp/audiowaveform.deb

View File

@ -2,28 +2,13 @@
set -e
set -x
PHP_VERSION=8.3
install-php-extensions @composer \
gd curl xml zip \
gmp pdo_mysql mbstring intl \
redis maxminddb \
ffi sockets
curl -S "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c" \
| sudo gpg --batch --yes --dearmor --output "/etc/apt/keyrings/php.gpg"
echo "deb [signed-by=/etc/apt/keyrings/php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" >> /etc/apt/sources.list.d/php.list
echo "deb-src [signed-by=/etc/apt/keyrings/php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" >> /etc/apt/sources.list.d/php.list
apt-get update
apt-get install -y --no-install-recommends php${PHP_VERSION}-cli php${PHP_VERSION}-gd \
php${PHP_VERSION}-curl php${PHP_VERSION}-xml php${PHP_VERSION}-zip \
php${PHP_VERSION}-gmp php${PHP_VERSION}-mysqlnd php${PHP_VERSION}-mbstring php${PHP_VERSION}-intl \
php${PHP_VERSION}-redis php${PHP_VERSION}-maxminddb
# Copy PHP configuration
echo "PHP_VERSION=$PHP_VERSION" >> /etc/php/.version
cp /bd_build/web/php/php.ini.tmpl /etc/php/${PHP_VERSION}/05-azuracast.ini.tmpl
cp /bd_build/web/php/php.ini.tmpl /usr/local/etc/php/php.ini.tmpl
# Enable FFI (for StereoTool inspection)
echo 'ffi.enable="true"' >> /etc/php/${PHP_VERSION}/mods-available/ffi.ini
# Install Composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
echo 'ffi.enable="true"' >> /usr/local/etc/php/conf.d/ffi.ini

View File

@ -2,6 +2,18 @@
set -e
set -x
# Per-architecture LS installs
ARCHITECTURE=amd64
if [[ "$(uname -m)" = "aarch64" ]]; then
ARCHITECTURE=arm64
fi
wget -O /tmp/sftpgo.deb "https://github.com/drakkan/sftpgo/releases/download/v2.5.6/sftpgo_2.5.6-1_${ARCHITECTURE}.deb"
dpkg -i /tmp/sftpgo.deb
apt-get install -y -f --no-install-recommends
rm -f /tmp/sftpgo.deb
mkdir -p /var/azuracast/sftpgo/persist \
/var/azuracast/sftpgo/backups \
/var/azuracast/sftpgo/env.d

View File

@ -1,5 +1,3 @@
#!/bin/bash
source /etc/php/.version
dockerize -template "/etc/php/${PHP_VERSION}/05-azuracast.ini.tmpl:/etc/php/${PHP_VERSION}/cli/conf.d/05-azuracast.ini"
dockerize -template "/usr/local/etc/php/php.ini.tmpl:/usr/local/etc/php/php.ini"