WinterCMS – Dockerfile for Caprover

Home   »   WinterCMS – Dockerfile for Caprover

FROM php:7.4-apache

ENV APP_PATH=/var/www/html

# 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", "/"]
runuser -u www-data -- php artisan winter:up


Leave a Reply

Your email address will not be published. Required fields are marked *