optimix-blog / Dockerfile
AurelianSolInvictus's picture
Update Dockerfile
01a554f verified
Raw History Blame Contribute Delete
1.03 kB
FROM wordpress:6.9.4-php8.2-apache
# Use the PORT environment variable provided by Hugging Face (default 7860)
ENV PORT 7860
RUN sed -i "s/80/${PORT}/g" /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
# Explicitly enable mod_rewrite
RUN a2enmod rewrite
# Force AllowOverride All for .htaccess support
RUN { \
echo '<Directory /var/www/html/>'; \
echo ' AllowOverride All'; \
echo '</Directory>'; \
} > /etc/apache2/conf-available/allow-override.conf && a2enconf allow-override
# Copy everything from the repo to the template directory
COPY . /usr/src/wordpress/
# Ensure correct permissions in the template
RUN chown -R www-data:www-data /usr/src/wordpress/
# Custom command to force-sync our files to the active /var/www/html before starting Apache
# This handles the case where /var/www/html already exists and the standard entrypoint skips copying.
CMD ["sh", "-c", "cp -r /usr/src/wordpress/. /var/www/html/ && chown -R www-data:www-data /var/www/html/ && exec apache2-foreground"]