39 lines
1.3 KiB
Docker
39 lines
1.3 KiB
Docker
FROM php:8.3-apache
|
|
|
|
# Install PostgreSQL PDO extension + curl
|
|
RUN apt-get update && apt-get install -y libpq-dev \
|
|
&& docker-php-ext-install pdo pdo_pgsql \
|
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Enable Apache mod_rewrite (needed for .htaccess routing)
|
|
RUN a2enmod rewrite headers
|
|
|
|
# Allow .htaccess overrides in webroot
|
|
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
|
|
|
|
# Copy app files
|
|
COPY . /var/www/html/
|
|
|
|
# Move public/index.html to webroot root, keep api/ and config accessible
|
|
# Directory layout inside container:
|
|
# /var/www/html/index.html ← frontend
|
|
# /var/www/html/api/ ← PHP endpoints
|
|
# /var/www/html/config.php ← credentials (injected via env)
|
|
# /var/www/html/schema.sql ← not served (blocked by .htaccess)
|
|
RUN cp /var/www/html/public/index.html /var/www/html/index.html \
|
|
&& rm -rf /var/www/html/public
|
|
|
|
# Config is generated at container start from env vars (see entrypoint.sh)
|
|
# Remove the static config.php — it will be written by entrypoint
|
|
RUN rm -f /var/www/html/config.php
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Writable temp dir for live status cache + twitch token cache
|
|
RUN mkdir -p /tmp/snb_cache && chown www-data:www-data /tmp/snb_cache
|
|
|
|
EXPOSE 80
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|