Optimize Dockerfile; switch to supercronic.
This commit is contained in:
parent
33f74430a0
commit
71ab777d31
30
Dockerfile
30
Dockerfile
|
@ -1,32 +1,15 @@
|
|||
#
|
||||
# Icecast build step
|
||||
#
|
||||
FROM ubuntu:jammy AS icecast
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -q -y --no-install-recommends \
|
||||
curl git ca-certificates \
|
||||
build-essential libxml2 libxslt1-dev libvorbis-dev libssl-dev libcurl4-openssl-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /tmp/install_icecast
|
||||
|
||||
RUN curl -fsSL -o icecast.tar.gz https://github.com/AzuraCast/icecast-kh-ac/archive/refs/tags/2.4.0-kh15-ac2.tar.gz \
|
||||
&& tar -xzvf icecast.tar.gz --strip-components=1 \
|
||||
&& ./configure \
|
||||
&& make \
|
||||
&& make install
|
||||
|
||||
#
|
||||
# Golang dependencies build step
|
||||
#
|
||||
FROM golang:1-bullseye AS dockerize
|
||||
FROM golang:1-bullseye AS go-dependencies
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends openssl git
|
||||
|
||||
RUN go install github.com/jwilder/dockerize@latest
|
||||
|
||||
RUN go install github.com/aptible/supercronic@latest
|
||||
|
||||
#
|
||||
# Final build image
|
||||
#
|
||||
|
@ -35,11 +18,8 @@ FROM mariadb:10.9-jammy
|
|||
ENV TZ="UTC"
|
||||
|
||||
# Add Dockerize
|
||||
COPY --from=dockerize /go/bin/dockerize /usr/local/bin
|
||||
|
||||
# Import Icecast-KH from build container
|
||||
COPY --from=icecast /usr/local/bin/icecast /usr/local/bin/icecast
|
||||
COPY --from=icecast /usr/local/share/icecast /usr/local/share/icecast
|
||||
COPY --from=go-dependencies /go/bin/dockerize /usr/local/bin
|
||||
COPY --from=go-dependencies /go/bin/supercronic /usr/local/bin/supercronic
|
||||
|
||||
# Run base build process
|
||||
COPY ./util/docker/common /bd_build/
|
||||
|
|
|
@ -2,8 +2,17 @@
|
|||
set -e
|
||||
set -x
|
||||
|
||||
# Only install Icecast deps (Icecast is handled by another container).
|
||||
apt-get install -y --no-install-recommends libxml2 libxslt1-dev libvorbis-dev
|
||||
# Build Icecast from source
|
||||
apt-get install -q -y --no-install-recommends \
|
||||
build-essential libxml2 libxslt1-dev libvorbis-dev libssl-dev libcurl4-openssl-dev openssl
|
||||
|
||||
# SSL self-signed cert generation
|
||||
apt-get install -y --no-install-recommends openssl
|
||||
mkdir -p /bd_build/stations/icecast
|
||||
cd /bd_build/stations/icecast
|
||||
|
||||
curl -fsSL -o icecast.tar.gz https://github.com/AzuraCast/icecast-kh-ac/archive/refs/tags/2.4.0-kh15-ac2.tar.gz
|
||||
tar -xzvf icecast.tar.gz --strip-components=1
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
apt-get remove --purge -y build-essential libssl-dev libcurl4-openssl-dev
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
SHELL=/bin/bash
|
||||
BASH_ENV=/container.env
|
||||
* * * * * root /usr/local/bin/cron_task azuracast_cli azuracast:sync:run
|
||||
30 */6 * * * root /usr/local/bin/temp_cleanup
|
||||
0 * * * * * * azuracast_cli azuracast:sync:run
|
||||
0 30 */6 * * * * temp_cleanup
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[program:cron]
|
||||
command=/usr/sbin/cron -f
|
||||
command=supercronic /etc/cron.d/azuracast
|
||||
priority=600
|
||||
numprocs=1
|
||||
autostart=true
|
||||
|
|
|
@ -2,38 +2,5 @@
|
|||
set -e
|
||||
set -x
|
||||
|
||||
install_without_postinst() {
|
||||
local PACKAGE
|
||||
PACKAGE=$1
|
||||
|
||||
mkdir -p /tmp/install_$PACKAGE
|
||||
cd /tmp/install_$PACKAGE
|
||||
|
||||
apt-get download $PACKAGE
|
||||
dpkg --unpack $PACKAGE*.deb
|
||||
rm -f /var/lib/dpkg/info/$PACKAGE.postinst
|
||||
dpkg --configure $PACKAGE
|
||||
|
||||
apt-get install -yf #To fix dependencies
|
||||
|
||||
cd /
|
||||
rm -rf /tmp/install_$PACKAGE
|
||||
}
|
||||
|
||||
install_without_postinst cron
|
||||
|
||||
chmod 600 /etc/crontab
|
||||
|
||||
# Fix cron issues in 0.9.19, see also #345: https://github.com/phusion/baseimage-docker/issues/345
|
||||
sed -i 's/^\s*session\s\+required\s\+pam_loginuid.so/# &/' /etc/pam.d/cron
|
||||
|
||||
## Remove useless cron entries.
|
||||
# Checks for lost+found and scans for mtab.
|
||||
rm -f /etc/cron.daily/standard
|
||||
rm -f /etc/cron.daily/upstart
|
||||
rm -f /etc/cron.daily/dpkg
|
||||
rm -f /etc/cron.daily/password
|
||||
rm -f /etc/cron.weekly/fstrim
|
||||
|
||||
mkdir -p /etc/cron.d/
|
||||
cp -r /bd_build/web/cron/. /etc/cron.d/
|
||||
chmod -R 600 /etc/cron.d/*
|
||||
|
|
|
@ -25,19 +25,13 @@ cp /bd_build/web/php/www.conf.tmpl /etc/php/${PHP_VERSION}/fpm/www.conf.tmpl
|
|||
# Install Composer
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
|
||||
|
||||
# Download PHP-FPM healthcheck script
|
||||
apt-get install -y --no-install-recommends libfcgi-bin
|
||||
|
||||
wget -O /usr/local/bin/php-fpm-healthcheck \
|
||||
https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck \
|
||||
&& chmod +x /usr/local/bin/php-fpm-healthcheck
|
||||
|
||||
# Install PHP SPX profiler
|
||||
apt-get install -y --no-install-recommends php${PHP_VERSION}-dev zlib1g-dev build-essential
|
||||
|
||||
cd /bd_build
|
||||
git clone https://github.com/NoiseByNorthwest/php-spx.git
|
||||
cd php-spx
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue