Repositories | Polyback | Log in to see private repositories


polyback-website / 32de824ed1c6d1185126d78087d2c781572f8c28 / Containerfile

2,419 bytes | root directory

# Minimal image for the Project Polygon website: nginx + PHP-FPM on Alpine.
# Secrets/config are NOT baked in: mount config.php at /var/www/polygonshared/config.php.
FROM docker.io/library/php:8.6-fpm-alpine

# git + git-daemon: the /git server (git-http-backend lives in Alpine's git-daemon package)
# Extensions beyond the base image's defaults (curl, sodium, fileinfo, simplexml are built in)
RUN set -eux; \
    apk add --no-cache nginx git git-daemon; \
    apk add --no-cache --virtual .build-deps $PHPIZE_DEPS libpng-dev libjpeg-turbo-dev libwebp-dev freetype-dev oniguruma-dev; \
    docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype; \
    docker-php-ext-install -j"$(nproc)" pdo_mysql gd exif mbstring; \
    runDeps="$(scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
        | tr ',' '\n' | sort -u | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }')"; \
    apk add --no-cache --virtual .phpext-rundeps $runDeps; \
    apk del .build-deps; \
    rm -rf /tmp/* /usr/src/php* /usr/local/include/php "$PHP_INI_DIR"/php.ini-development; \
    rm -f /usr/local/etc/php-fpm.d/*.conf /etc/nginx/http.d/*.conf; \
    php -m | grep -qx gd && php -m | grep -qx mbstring && php -m | grep -qx pdo_mysql

COPY container/php.ini        $PHP_INI_DIR/conf.d/zz-polygon.ini
COPY container/php-fpm.conf   /usr/local/etc/php-fpm.d/www.conf
COPY container/nginx.conf     /etc/nginx/nginx.conf
COPY container/entrypoint.sh  /entrypoint.sh

COPY --chown=www-data:www-data . /var/www/polygon

RUN set -eux; \
    rm -rf /var/www/polygon/container /var/www/polygon/Containerfile /var/www/polygon/nginx.conf; \
    mkdir -p /var/www/polygonshared/assets /var/www/polygondata/assets /var/www/polygonshared/thumbs/assets /var/www/polygonshared/thumbs/avatars /var/www/polygoncdn /var/www/polygondata/git /run/nginx; \
    echo "[]" > /var/www/polygon/api/private/ErrorLog.json; \
    chown -R www-data:www-data /var/www/polygonshared/assets /var/www/polygonshared/thumbs /var/www/polygondata /var/www/polygoncdn /var/www/polygon/thumbs /var/www/polygon/api/private/ErrorLog.json; \
    chmod +x /entrypoint.sh

WORKDIR /var/www/polygon
EXPOSE 8080
VOLUME ["/var/www/polygonshared/assets", "/var/www/polygondata", "/var/www/polygonshared/thumbs/assets", "/var/www/polygonshared/thumbs/avatars", "/var/www/polygoncdn"]
ENTRYPOINT ["/entrypoint.sh"]