Skip to content

Instantly share code, notes, and snippets.

@LouisBertin
Created May 4, 2021 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LouisBertin/8f0fcb248d62f3e17960aee447736344 to your computer and use it in GitHub Desktop.
Save LouisBertin/8f0fcb248d62f3e17960aee447736344 to your computer and use it in GitHub Desktop.
WinterCMS - Dockerfile for Caprover
FROM php:7.4-apache
ENV APP_PATH=/var/www/html
WORKDIR $APP_PATH
# update, upgrade and install package
RUN apt update -y && apt upgrade -y \
&& apt-get install -y build-essential
# Php extensions
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions intl gd pdo_mysql opcache zip @composer-2
COPY .docker/php.ini /usr/local/etc/php/conf.d/app.ini
# Apache
COPY .docker/vhost.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite
# Copy application source
COPY --chown=www-data . $APP_PATH
USER www-data
RUN composer install --no-dev --optimize-autoloader --no-cache
RUN php artisan winter:mirror public \
&& php artisan config:cache \
&& php artisan route:cache
# Artisan commands
RUN chmod -R 777 $APP_PATH/storage && chown -R www-data:www-data $APP_PATH
USER root
COPY .docker/entrypoint.sh /
EXPOSE 80
ENTRYPOINT ["sh", "/entrypoint.sh"]
#!/bin/sh
runuser -u www-data -- php artisan winter:up
apache2-foreground
date.timezone = Europe/Paris
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 128
opcache.revalidate_freq = 0
apc.enable_cli = On
upload_max_filesize = 16M
post_max_size = 16M
realpath_cache_size = 4096k
realpath_cache_ttl = 7200
display_errors = Off
display_startup_errors = Off
expose_php = Off
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment