Skip to content

Instantly share code, notes, and snippets.

@erycson
Forked from paulredmond/Dockerfile
Last active August 7, 2019 14:36
Show Gist options
  • Save erycson/31c4fe9536affaaaf296e6669be354b7 to your computer and use it in GitHub Desktop.
Save erycson/31c4fe9536affaaaf296e6669be354b7 to your computer and use it in GitHub Desktop.
A Dockerfile for a Laravel PHP Application with Caddy Server
0.0.0.0
root /srv/app/public
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
regexp .*
ext /
to /index.php?{query}
}
log stdout
errors stdout
on startup php-fpm --nodaemonize
# docker build -t laravel-image .
# CMD
# docker run -it --rm -v %cd%:/srv/app -p 80:9000 --name laravel laravel-image
# PowerShell
# docker run -it --rm -v ${PWD}:/srv/app -p 80:9000 --name laravel laravel-image
# Linux
# docker run -it --rm -v $(pwd):/srv/app -p 80:9000 --name laravel laravel-image
FROM php:7.3-fpm-alpine
LABEL maintainer="Érycson Nóbrega <[email protected]>"
LABEL version="1.0.0"
# 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&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
COPY . /srv/app
COPY ./Caddyfile /etc/Caddyfile
WORKDIR /srv/app/
RUN chown -R www-data:www-data /srv/app
CMD ["/usr/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment