Skip to content

u/St0lz

In this archive from Oct 2014 to Dec 2020

0
posts
7
comments
0
media
12
score

Top comments

I was in a similar situation months ago. All the images I could find seemed over complicated (compiling, or putting all the stack in a single container which goes against Docker recommended best practices, specially knowing most of the components of the usual Laravel stack have an official and well maintained Docker image), so I created my own stack based on Docker Compose:

https://github.com/Stolz/laravel-docker-stack

It uses the latest version of the official Alpine Linux images so creating/updating/deploying the containers takes no time. The only modification of the PHP image is adding Supervisord and Postgres and Redis PHP extensions. Instead of Postgres you could easily use the official MySQL image if you prefer but AFAIK there is no Alpine version for it.

The only reason it says is not for production is because the source code and .env file are provided to the container via Docker volumes to aid with the development instead of being built into the container. Other than that is played by the book.

2 points

I plan to switch the reverse proxy image from nginx to Traefik.

Nginx is not being used as a reverse proxy in this set up. It serves the Laravel app. I personally also use Traefik for all of my containers so I don't have to bother opening and remembering ports.

What advantage are you getting with Supervisor?

The only reason Supervisor is used is so that both PHP-FPM and Laravel queue workers run at the same time in the same container. The advantage is you can control the number and type of queue workers without having to rebuild the container. If you don't plan on using the Laravel queues there is no need for using Supervisor. In that case, you could leave the original entrypoint of the container intact and everything (except queues) will still work. Queues are my favourite Laravel fearure so I cannot image using Laravel without them, that's why I included support for them.

Should such a feature be needed, another image using any job scheduler and exposing an API should work right?

Supervisor is used for service supervision. It runs long-lasting processes and ensures they are restarted in case they fail. AFAIK it doesn't have any API. Yes, you could put the Laravel queue in a separate container but to ensure the queues work well you will need to replicate the exact same PHP environment that you already have in your FPM container, which seems pointless.

I don't see an .env file being included anywhere

The idea of the approach is making developing in Laravel as similar as possible as they way you would do it without Docker. The same way Laravel does not incluide a .env file this repo doesn't include one too. You have create it similarly as you would do it without Docker. That way you can configure Laravel to your needs. The whole Laravel directory is part of a volume, so you just have to copy your own .env file into the Laravel directory and the container will use it.

1 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.