Last active
January 16, 2024 17:22
-
-
Save faghani/a38b3e1014686656937930e0306ec606 to your computer and use it in GitHub Desktop.
Caddy Laravel Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Max memory per instance | |
memory_limit = 128M | |
;The maximum size of an uploaded file. | |
upload_max_filesize = 128M | |
;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize | |
post_max_size = 128M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Date] | |
date.timezone="UTC" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opcache.enable=1 | |
opcache.memory_consumption=512 | |
opcache.interned_strings_buffer=64 | |
opcache.max_accelerated_files=32531 | |
opcache.validate_timestamps=0 | |
opcache.save_comments=1 | |
opcache.fast_shutdown=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expose_php=Off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;session serialization handler | |
session.serialize_handler=igbinary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0.0.0.0 | |
root /var/www/public | |
gzip | |
fastcgi / 127.0.0.1:9000 php | |
rewrite { | |
regexp .* | |
ext / | |
to /index.php?{query} | |
} | |
errors stdout | |
on startup php-fpm --nodaemonize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM composer:1.7 as vendor | |
COPY database/ database/ | |
COPY composer.json composer.json | |
COPY composer.lock composer.lock | |
RUN composer install \ | |
--ignore-platform-reqs \ | |
--no-interaction \ | |
--no-plugins \ | |
--no-scripts \ | |
--optimize-autoloader \ | |
--prefer-dist | |
FROM node:8.11 as frontend | |
RUN mkdir -p /app/public | |
COPY package.json webpack.mix.js yarn.lock /app/ | |
COPY resources/js/ /app/resources/js/ | |
COPY resources/sass/ /app/resources/sass/ | |
WORKDIR /app | |
RUN yarn install && yarn production | |
FROM php:7.3-fpm | |
LABEL maintainer="Alireza faghani <faghani.a@gmail.com>" | |
RUN apt-get update && apt-get install -y git zip unzip | |
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&telemetry=off" \ | |
| 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 opcache | |
WORKDIR /var/www/ | |
COPY . /var/www/ | |
COPY --from=vendor /app/vendor/ /var/www/vendor/ | |
COPY --from=frontend /app/public/js/ /var/www/public/js/ | |
COPY --from=frontend /app/public/css/ /var/www/public/css/ | |
COPY --from=frontend /app/mix-manifest.json /var/www/public/mix-manifest.json | |
COPY .docker/Caddyfile /etc/Caddyfile | |
COPY .docker/config/* $PHP_INI_DIR/conf.d/ | |
RUN chown -R www-data:www-data /var/www/ | |
# laravel setup | |
RUN mv .env.prod .env | |
RUN php artisan migrate \ | |
&& php artisan config:cache \ | |
&& php artisan route:cache | |
EXPOSE 2015 | |
CMD ["/usr/bin/caddy", "-agree=true", "-conf=/etc/Caddyfile"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Socket is insanely powerful than tcp 9000 port.