本节适用于开发人员及运维人员阅读。阅读全文需8分钟
准备工程
新建一个 Laravel 项目或在已有的 Laravel 项目根目录下新建Dockerfile、.dockerignore、laravel.conf 文件。
在 .dockerignore 文件中写入以下内容。
.idea/
.git/
vendor/
node_modules/
public/js/
public/css/
yarn-error.log
bootstrap/cache/*
storage/
# 自行添加其他需要排除的文件,例如 .env.* 文件
在 laravel.conf 文件中写入 nginx 配置。
server {
listen 80 default_server;
root /app/laravel/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .*\.php(\/.*)*$ {
fastcgi_pass laravel:9000;
include fastcgi.conf;
# fastcgi_connect_timeout 300;
# fastcgi_send_timeout 300;
# fastcgi_read_timeout 300;
}
}
前端构建
第一阶段进行前端构建。
FRO