# syntax=docker/dockerfile:1.7 ############################################ # Stage 1: fetch source ############################################ FROM alpine:3.20 AS source ARG DALOREF=master ARG MIRROR_URL=https://gitea.portal.tulsacounty.org/external-repos/daloradius.git RUN apk add --no-cache git && \ git clone --depth=1 --branch ${DALOREF} ${MIRROR_URL} /src ############################################ # Stage 2: runtime (PHP 8, Apache) ############################################ FROM php:8.3-apache ENV TZ=UTC DBPORT=3306 # System deps RUN apt-get update && apt-get -y upgrade && \ apt-get install -y --no-install-recommends \ ca-certificates tzdata curl git \ libpng-dev libjpeg62-turbo-dev libfreetype6-dev libwebp-dev \ libmariadb-dev \ && rm -rf /var/lib/apt/lists/* && \ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone && \ update-ca-certificates -f # PHP extensions RUN docker-php-ext-configure gd --with-freetype --with-jpeg && \ docker-php-ext-install gd mysqli pdo_mysql # PEAR + required packages RUN curl -fsSL https://pear.php.net/install-pear-nozlib.phar -o /tmp/pear.phar \ && php /tmp/pear.phar \ && rm /tmp/pear.phar \ && pear channel-update pear.php.net \ && pear install -a -f DB \ && pear install -a -f Mail \ && pear install -a -f Mail_Mime # App COPY --from=source /src/app/ /var/www/html/daloradius/ COPY --from=source /src/app/common/includes/daloradius.conf.php.sample /opt/daloradius.conf.php.tmpl # Our Apache vhost (serve operators UI at /) COPY apache/000-default.conf /etc/apache2/sites-available/000-default.conf RUN a2enmod rewrite && apache2ctl -t && \ printf 'ServerName localhost\n' > /etc/apache2/conf-available/servername.conf && a2enconf servername # DB override snippet + entrypoint COPY config/override-db.php /opt/override-db.php COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh COPY php/99-daloradius.ini /usr/local/etc/php/conf.d/99-daloradius.ini # Permissions (readable by Apache) RUN chown -R www-data:www-data /var/www/html && \ find /var/www/html -type d -exec chmod 755 {} \; && \ find /var/www/html -type f -exec chmod 644 {} \; EXPOSE 80 HEALTHCHECK --interval=30s --timeout=5s --retries=5 CMD curl -fsS http://localhost/ || exit 1 ENTRYPOINT ["/entrypoint.sh"]