another / Dockerfile
sohom004's picture
Update Dockerfile
d460a99 verified
# Use official WordPress with Apache (Debian)
FROM wordpress:php8.2-apache
# Install build tools + SQLite dependencies
RUN apt-get update && apt-get install -y \
curl unzip jq awscli \
python3-pip zip \
rsync git git-lfs \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
libsqlite3-dev \
libzip-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Enable SQLite only if missing
RUN if ! php -m | grep -qi sqlite3; then \
docker-php-ext-install sqlite3; \
fi
# Install WP-CLI
RUN curl -sSLo /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x /usr/local/bin/wp
# install python dependencies
COPY requirements.txt /root/requirements.txt
RUN pip install -r /root/requirements.txt --break-system-packages
# login internetarchive (moved to entrypoint.sh)
##RUN ia configure -u <email> -p <password>
# Copy helper scripts
COPY entrypoint.sh /usr/local/bin/space-entrypoint
# COPY backup-loop.sh /usr/local/bin/backup-loop
#COPY wp-config-patches.php /tmp/wp-config-patches.php
RUN chmod +x /usr/local/bin/space-entrypoint
# RUN chmod +x /usr/local/bin/backup-loop
# Copy patch script
COPY wp-config-patch.sh /usr/local/bin/wp-config-patch.sh
RUN chmod +x /usr/local/bin/wp-config-patch.sh
#COPY .htaccess /var/www/html/.htaccess
#RUN chown www-data:www-data /var/www/html/.htaccess
COPY .public /root/.public
COPY wp-hf-sync.php /tmp/wp-hf-sync.php
COPY hf-sync-loop.sh /usr/local/bin/hf-sync-loop
RUN chmod +x /usr/local/bin/hf-sync-loop
COPY backup-loop.sh /usr/local/bin/backup-loop
RUN chmod +x /usr/local/bin/backup-loop
# Ensure Apache runs as non-interactive, and allow dynamic port
ENV APACHE_RUN_USER=www-data \
APACHE_RUN_GROUP=www-data
# Increase WP-CLI memory via config file
RUN mkdir -p /etc/wp-cli \
&& printf "php:\n ini:\n memory_limit: 256M\n" > /etc/wp-cli/config.yml
# Healthcheck (simple HTTP HEAD)
# HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
# CMD curl -fsS http://127.0.0.1:${PORT:-7860}/ || exit 1
EXPOSE ${PORT:-7860}
# Entrypoint
ENTRYPOINT ["/usr/local/bin/space-entrypoint"]
# Default command (Apache)
CMD ["apache2-foreground"]