-
Notifications
You must be signed in to change notification settings - Fork 55
/
Dockerfile.develop.template
85 lines (70 loc) · 3.45 KB
/
Dockerfile.develop.template
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
80
81
82
83
84
85
FROM php:%%PHP_VERSION%%-%%VARIANT%%
RUN apt-get update && apt-get install -y cron git-core jq unzip vim zip \
libjpeg-dev libpng-dev libpq-dev libsqlite3-dev libwebp-dev libzip-dev && \
rm -rf /var/lib/apt/lists/* && \
%%PHP_ZIP_CONFIG%% && \
%%PHP_GD_CONFIG%% && \
docker-php-ext-install exif gd mysqli opcache pdo_pgsql pdo_mysql zip
# Recommended opcache settings - https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/docker-oc-opcache.ini
RUN { \
echo 'log_errors=on'; \
echo 'display_errors=off'; \
echo 'upload_max_filesize=32M'; \
echo 'post_max_size=32M'; \
echo 'memory_limit=128M'; \
} > /usr/local/etc/php/conf.d/docker-oc-php.ini
RUN pecl install xdebug
RUN { \
echo "#zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" ; \
echo 'xdebug.remote_enable=on'; \
echo 'xdebug.remote_autostart=off'; \
echo 'xdebug.remote_host=host.docker.internal'; \
} > /usr/local/etc/php/conf.d/docker-xdebug-php.ini
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
%%VARIANT_EXTRAS%%
COPY config/docker /usr/src/octobercms-config-docker
ENV OCTOBERCMS_TAG develop
ENV OCTOBERCMS_DEVELOP_CHECKSUM %%OCTOBERCMS_DEVELOP_CHECKSUM%%
ENV OCTOBERCMS_DEVELOP_COMMIT %%OCTOBERCMS_DEVELOP_COMMIT%%
# Consolidated October CMS setup
RUN git clone https://github.com/octobercms/october.git -b $OCTOBERCMS_TAG . && \
# download dependencies
composer install --no-interaction --prefer-dist --no-scripts && \
composer clearcache && \
# ensure modules are in sync with the repo after composer install
git status && git checkout modules/. && \
# setup docker env
echo 'APP_ENV=docker' > .env && \
mv /usr/src/octobercms-config-docker config/docker && \
echo 'config/docker' >> .git/info/exclude && \
# setup database
touch storage/database.sqlite && \
chmod 666 storage/database.sqlite && \
php artisan october:up && \
# add October Drivers
php artisan plugin:install october.drivers && \
# permissions
chown -R www-data:www-data /var/www/html && \
find . -type d \( -path './plugins' -or -path './storage' -or -path './themes' -or -path './plugins/*' -or -path './storage/*' -or -path './themes/*' \) -exec chmod g+ws {} \;
# Initialize crontab for the October CMS scheduler
RUN echo "* * * * * /usr/local/bin/php /var/www/html/artisan schedule:run > /proc/1/fd/1 2>/proc/1/fd/2" > /etc/cron.d/october-cron && \
crontab /etc/cron.d/october-cron
# Add helpers
RUN echo 'exec php artisan "$@"' > /usr/local/bin/artisan && \
echo 'exec php artisan tinker' > /usr/local/bin/tinker && \
echo '[ $# -eq 0 ] && exec php artisan october || exec php artisan october:"$@"' > /usr/local/bin/october && \
sed -i '1s;^;#!/bin/bash\n[ "$PWD" != "/var/www/html" ] \&\& echo " - Helper must be run from /var/www/html" \&\& exit 1\n;' /usr/local/bin/artisan /usr/local/bin/tinker /usr/local/bin/october && \
chmod +x /usr/local/bin/artisan /usr/local/bin/tinker /usr/local/bin/october
COPY docker-oc-entrypoint /usr/local/bin/
ENTRYPOINT ["docker-oc-entrypoint"]
CMD ["%%CMD%%"]