updated caddyfile

This commit is contained in:
Jack Goh
2018-07-18 17:29:42 +08:00
parent 0c7ae77133
commit b535ddf80c
3 changed files with 81 additions and 17 deletions
+64 -2
View File
@@ -11,5 +11,67 @@ RUN php artisan clear-compiled
COPY wait.sh /usr/local/bin/wait.sh
RUN chmod +x /usr/local/bin/wait.sh
CMD /usr/local/bin/wait.sh && composer update --no-scripts && composer dumpautoload && php artisan storage:link && php artisan migrate && php artisan serve --host=0.0.0.0 --port=8000
EXPOSE 8000
FROM php:7.1-fpm
# Update packages and install composer and PHP dependencies.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
postgresql-client \
libpq-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libbz2-dev \
cron \
&& pecl channel-update pecl.php.net \
&& pecl install apcu
# PHP Extensions
RUN docker-php-ext-install mcrypt zip bz2 mbstring pdo pdo_pgsql pcntl \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd
# Memory Limit
RUN echo "memory_limit=2048M" > $PHP_INI_DIR/conf.d/memory-limit.ini
RUN echo "max_execution_time=900" >> $PHP_INI_DIR/conf.d/memory-limit.ini
RUN echo "extension=apcu.so" > $PHP_INI_DIR/conf.d/apcu.ini
RUN echo "post_max_size=20M" >> $PHP_INI_DIR/conf.d/memory-limit.ini
RUN echo "upload_max_filesize=20M" >> $PHP_INI_DIR/conf.d/memory-limit.ini
# Time Zone
RUN echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini
# Display errors in stderr
RUN echo "display_errors=stderr" > $PHP_INI_DIR/conf.d/display-errors.ini
# Disable PathInfo
RUN echo "cgi.fix_pathinfo=0" > $PHP_INI_DIR/conf.d/path-info.ini
# Disable expose PHP
RUN echo "expose_php=0" > $PHP_INI_DIR/conf.d/path-info.ini
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ADD . /var/www/html
WORKDIR /var/www/html
RUN touch storage/logs/laravel.log
RUN composer install
#RUN php artisan cache:clear
#RUN php artisan view:clear
#RUN php artisan route:cache
RUN chmod -R 777 /var/www/html/storage
RUN touch /var/log/cron.log
ADD deploy/cron/artisan-schedule-run /etc/cron.d/artisan-schedule-run
RUN chmod 0644 /etc/cron.d/artisan-schedule-run
RUN chmod +x /etc/cron.d/artisan-schedule-run
RUN touch /var/log/cron.log
CMD ["/usr/local/bin/wait.sh", "/bin/sh", "-c", "php-fpm -D | tail -f storage/logs/laravel.log"]
+4 -3
View File
@@ -1,7 +1,7 @@
# Docs: https://caddyserver.com/docs/caddyfile
https://exchange-staging.izyim.com {
root /var/www/public
fastcgi / 127.0.0.1:8000 php {
fastcgi / 127.0.0.1:9000 php {
index index.php
}
@@ -13,8 +13,9 @@ https://exchange-staging.izyim.com {
}
gzip
browse
log /var/log/caddy/access.log
errors /var/log/caddy/error.log
log stdout
errors stdout
on startup php-fpm --nodaemonize
# Uncomment to enable TLS (HTTPS)
# Change the first list to listen on port 443 when enabling TLS
tls admin@izyim.com
+13 -12
View File
@@ -1,17 +1,18 @@
FROM zuohuadong/caddy:alpine
FROM php:7.1-fpm
LABEL maintainer="Paul Redmond <paul@bitpress.io>"
LABEL maintainer="Huadong Zuo <admin@zuohuadong.cn>"
# Install application dependencies
RUN curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://caddyserver.com/download/linux/amd64?plugins=http.expires,http.realip&license=personal" \
| tar --no-same-owner -C /usr/bin/ -xz caddy \
&& chmod 0755 /usr/bin/caddy \
&& /usr/bin/caddy -version \
&& docker-php-ext-install mbstring pdo pdo_mysql
ARG plugins="cors"
## ARG plugins="cors cgi cloudflare azure linode"
RUN caddyplug install ${plugins}
EXPOSE 80 443 2015
COPY Caddyfile /etc/Caddyfile
WORKDIR /var/www/public
RUN chown -R www-data:www-data /var/www/public
CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile","-agree"]
CMD ["/usr/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout"]