-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
79 lines (67 loc) · 3.25 KB
/
Copy pathDockerfile
File metadata and controls
79 lines (67 loc) · 3.25 KB
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
73
74
75
76
77
78
79
# UNT Robotics website — PHP/Apache application image.
#
# Production currently runs PHP 7.2 + Apache (mod_php). This image targets the
# modern PHP 8.3; expect some 7.2 -> 8.3 compatibility fixes to surface when the
# stack is exercised. Apache + mod_rewrite is kept so the existing .htaccess
# routing works unchanged (lift-and-shift).
FROM php:8.3-apache
# --- PHP extensions -----------------------------------------------------------
# Only what the codebase actually uses: mysqli/pdo_mysql (DB), gmp (Discord
# ed25519 verify via simplito/elliptic-php), bcmath, intl, zip, mbstring, exif,
# calendar, gettext, opcache. curl/openssl/sodium are already built into the
# official image. gd/imap/soap/mailparse are unused and intentionally omitted.
RUN apt-get update && apt-get install -y --no-install-recommends \
libicu-dev \
libgmp-dev \
libzip-dev \
libonig-dev \
git \
unzip \
&& docker-php-ext-install -j"$(nproc)" \
mysqli \
pdo_mysql \
bcmath \
gmp \
intl \
zip \
mbstring \
exif \
calendar \
gettext \
opcache \
&& rm -rf /var/lib/apt/lists/*
# Composer (for the Discord interactions endpoint's ed25519 dependency).
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Production-oriented PHP settings (errors logged, not displayed).
COPY docker/php/zz-untrobotics.ini "$PHP_INI_DIR/conf.d/zz-untrobotics.ini"
# --- Apache -------------------------------------------------------------------
# Enable rewrite + headers and allow .htaccess overrides under the docroot.
RUN a2enmod rewrite headers \
&& sed -ri 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf \
&& echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Pipe the Apache error log to a shared file (for the Discord log-forwarder
# sidecar) AND keep it on stderr (kubectl logs). The server-scope piped logger
# is in error-log.conf; drop the vhost ErrorLog so the vhost inherits it.
COPY docker/apache/error-log.conf /etc/apache2/conf-enabled/error-log.conf
RUN sed -ri '/ErrorLog.*error\.log/d' /etc/apache2/sites-available/000-default.conf \
&& mkdir -p /var/log/forward
WORKDIR /var/www/html
COPY . /var/www/html/
# Use the environment-driven config inside the container. The real (secret)
# template/config.php is excluded from the build context by .dockerignore.
RUN cp template/config.docker.php template/config.php
# Install the Discord endpoint's ed25519 library (declared in composer.json).
RUN composer install --no-dev --no-interaction --prefer-dist \
--working-dir=api/discord/interactions
# Install the Stripe SDK (declared in api/stripe/composer.json) for Checkout +
# Apple Pay (create-checkout-session.php / webhook.php).
RUN composer install --no-dev --no-interaction --prefer-dist \
--working-dir=api/stripe
# Install PHPMailer (declared in api/mailer/composer.json) — outbound email()
# in template/top.php sends via SMTP to the self-hosted Postfix relay.
RUN composer install --no-dev --no-interaction --prefer-dist \
--working-dir=api/mailer
# Runtime-writable directories + ownership.
RUN mkdir -p paypal/logs api/rocketry/gps/locations cron \
&& chown -R www-data:www-data /var/www/html
EXPOSE 80