File size: 2,228 Bytes
c20b8de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d460a99
c20b8de
14688db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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"]