S
S
Sergey Sokolov2019-12-23 12:54:48
Docker
Sergey Sokolov, 2019-12-23 12:54:48

How to deploy Laravel + Vue application in Docker?

There is no system understanding of the correct devops'ing yet, everything is on the knee and at the wrong time. The book "Docker in Practice" (2nd edition) just downloaded and looked through. Therefore, a quick question for those who have skis on the go.
Laravel web application with VueJS front end, which needs to be built with webpack. I wrapped everything in containers:

  • Redis
  • MySQL
  • php-fpm
  • nginx
and support
  1. git для git pull origin master
  2. Composer для composer update
  3. NodeJS для npm run build
  4. phpMyAdmin
  5. Certbot для обновления сертификатов Let's Encrypt

Files in docker volumes. The application is managed via docker-compose.
Everything works, but after making additions to the repo, I have to rebuild webpack, maybe update the packages directly on the live one with composer.
There are vague suspicions that this should not be done this way, do not repeat once again on the prod server the “build” of composer b webpack — or, perhaps, you need to roll out ready-made Docker images, where everything is built in advance and checked by tests. And in production, it's easy to change containers, or switch the arrow of nginx or the front (optional, now it's gone) load-balancer.
If you understand the situation and the answer is obvious, please explain how to do it right without complicating the process too much compared to the current one.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2019-12-23
@sergiks

Everything works, but after adding additions to the repo, you have to rebuild webpack, maybe update the packages directly on live with composer

Do you store data in docker containers?
The usual case, for example, for building the front - they changed something in the repo - the hook that starts the auto-deploy worked.
The auto-deploy takes changes from the turnip and launches a container with a node or whatever you have there, which mounts the source directory and builds the project. After a successful build, the container with the node exits, and the auto-deploy script further pulls the container with nginx to apply the changes.
That's actually all.
Images are used assembled once. As a rule, nothing is added to them during auto-deploy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question