FROM php:8.3-apache-trixie
ARG COOLIFY_URL=http://rnssrv.com,http://www.rnssrv.com
ARG COOLIFY_FQDN=rnssrv.com,www.rnssrv.com
ARG COOLIFY_BRANCH=main
ARG COOLIFY_RESOURCE_UUID=oti252ozxcs9z8beyb42wn2i
ARG COOLIFY_BUILD_SECRETS_HASH=68e636bef913ee575d4d6071593b69fb981f87105e418f0384da5f661593381c
# GD and exif: the UberGallery photo pages need them (thumbnails, image type checks).
RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y --no-install-recommends libpng-dev libjpeg62-turbo-dev libfreetype6-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j"$(nproc)" gd exif \
    && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . /app
# Serve /app as the document root (as before) and let its .htaccess files apply.
RUN rm -fr .git \
    && sed -ri -e 's!/var/www/html!/app!g' -e 's!/var/www/!/app/!g' -e 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf /etc/apache2/sites-available/*.conf \
    && chown -R www-data:www-data /app
EXPOSE 80