diff --git a/Dockerfile b/Dockerfile index ddfe71377..f22741faf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/util/docker/common/prepare.sh b/util/docker/common/prepare.sh index 6fcfa7b71..b50f9aa2b 100644 --- a/util/docker/common/prepare.sh +++ b/util/docker/common/prepare.sh @@ -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 diff --git a/util/docker/dev/scripts/run_php_fpm b/util/docker/dev/scripts/run_php_fpm index 8936715ca..de70c1f74 100644 --- a/util/docker/dev/scripts/run_php_fpm +++ b/util/docker/dev/scripts/run_php_fpm @@ -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 diff --git a/util/docker/dev/setup/php.sh b/util/docker/dev/setup/php.sh index 6c9a6fa2b..b3c89b522 100644 --- a/util/docker/dev/setup/php.sh +++ b/util/docker/dev/setup/php.sh @@ -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 diff --git a/util/docker/mariadb/startup_scripts/05_setup_db.sh b/util/docker/mariadb/startup_scripts/05_setup_db.sh index 5310477bd..aef8267f4 100644 --- a/util/docker/mariadb/startup_scripts/05_setup_db.sh +++ b/util/docker/mariadb/startup_scripts/05_setup_db.sh @@ -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 diff --git a/util/docker/redis/setup/redis.sh b/util/docker/redis/setup/redis.sh index c332e5da5..442b8c40f 100644 --- a/util/docker/redis/setup/redis.sh +++ b/util/docker/redis/setup/redis.sh @@ -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 diff --git a/util/docker/stations/setup/icecast.sh b/util/docker/stations/setup/icecast.sh index ef8830760..6992676c1 100644 --- a/util/docker/stations/setup/icecast.sh +++ b/util/docker/stations/setup/icecast.sh @@ -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 diff --git a/util/docker/stations/setup/liquidsoap.sh b/util/docker/stations/setup/liquidsoap.sh index 2e71b3743..66b0858f7 100644 --- a/util/docker/stations/setup/liquidsoap.sh +++ b/util/docker/stations/setup/liquidsoap.sh @@ -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 diff --git a/util/docker/supervisor/setup/supervisor.sh b/util/docker/supervisor/setup/supervisor.sh index 85da8fbd8..5a6dc38d7 100644 --- a/util/docker/supervisor/setup/supervisor.sh +++ b/util/docker/supervisor/setup/supervisor.sh @@ -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 diff --git a/util/docker/web/setup/00_packages.sh b/util/docker/web/setup/00_packages.sh index 01b8684b8..6e4b0a315 100644 --- a/util/docker/web/setup/00_packages.sh +++ b/util/docker/web/setup/00_packages.sh @@ -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 diff --git a/util/docker/web/setup/audiowaveform.sh b/util/docker/web/setup/audiowaveform.sh new file mode 100644 index 000000000..c83f853d2 --- /dev/null +++ b/util/docker/web/setup/audiowaveform.sh @@ -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 diff --git a/util/docker/web/setup/php.sh b/util/docker/web/setup/php.sh index 8ce66716f..eb725d168 100644 --- a/util/docker/web/setup/php.sh +++ b/util/docker/web/setup/php.sh @@ -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 diff --git a/util/docker/web/setup/sftpgo.sh b/util/docker/web/setup/sftpgo.sh index 5cb2fd423..fac0c3b4d 100644 --- a/util/docker/web/setup/sftpgo.sh +++ b/util/docker/web/setup/sftpgo.sh @@ -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 diff --git a/util/docker/web/startup_scripts/06_php_conf.sh b/util/docker/web/startup_scripts/06_php_conf.sh index 2640a7d09..3ecc1e670 100644 --- a/util/docker/web/startup_scripts/06_php_conf.sh +++ b/util/docker/web/startup_scripts/06_php_conf.sh @@ -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"