View Raw # Use official PHP image with FPM
FROM php:8.3-fpm-alpine
# Set maintainer and version
LABEL maintainer="5q12"
LABEL description="5q12's Indexer - Web-based file browser and indexer"
LABEL version="1.1.15"
# Install system dependencies and build tools
RUN apk add --no-cache \
nginx \
supervisor \
sqlite \
sqlite-dev \
zip \
unzip \
curl \
ca-certificates \
libzip-dev
# Install PHP extensions
RUN docker-php-ext-install \
pdo_sqlite \
zip \
&& docker-php-ext-enable \
pdo_sqlite \
zip
# Ensure www-data user exists with correct UID/GID
RUN if ! getent group www-data >/dev/null; then addgroup -g 82 -S www-data; fi && \
if ! getent passwd www-data >/dev/null; then adduser -u 82 -D -S -G www-data www-data; fi
# Create necessary directories
RUN mkdir -p /www/indexer \
&& mkdir -p /var/log/nginx \
&& mkdir -p /var/log/supervisor \
&& mkdir -p /run/nginx \
&& mkdir -p /run/php \
&& mkdir -p /config \
&& mkdir -p /files
# Copy nginx configuration
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker/5q12-indexer.conf /etc/nginx/http.d/default.conf
# Copy PHP-FPM configuration
COPY docker/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
# Copy supervisor configuration
COPY docker/supervisord.conf /etc/supervisord.conf
# Copy indexer files
COPY index.php /www/indexer/
COPY docker/entrypoint.sh /entrypoint.sh
# Create symlinks from application paths to mount points
# Make sure the target directories exist first
RUN mkdir -p /www/indexer/.indexer_files /www/indexer/files \
&& rm -rf /www/indexer/.indexer_files /www/indexer/files \
&& ln -sf /config /www/indexer/.indexer_files \
&& ln -sf /files /www/indexer/files
# Set permissions
RUN chown -R www-data:www-data /www/indexer \
&& chown -R www-data:www-data /config \
&& chown -R www-data:www-data /files \
&& chmod +x /entrypoint.sh \
&& chmod 644 /www/indexer/index.php
# Create volume mount points
VOLUME ["/config", "/files"]
# Expose port 5012
EXPOSE 5012
# Set working directory
WORKDIR /www/indexer
# Health check to ensure the service is running
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:5012/ || exit 1
# Use entrypoint script
ENTRYPOINT ["/entrypoint.sh"]
# Start supervisor
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]