1 Star 0 Fork 0

徐添翼 / docker-laravel-swoole

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

docker-laravel-swoole

Deployment Docker image for Laravel Octane (Swoole) 适用于部署 Laravel Octane (Swoole) 的 docker 镜像

Useage

Configure Laravel Octane

  1. Follow the official documentation to configure Laravel Octane
$ composer require laravel/octane
  1. Run Octane install commend and choose "swoole"
$ php artisan octane:install

Which application server you would like to use?:
  [0] roadrunner
  [1] swoole
 > 1 
 
  INFO  Octane installed successfully.
  1. If you didn't install swoole on host machine, it may says:
 WARN  The Swoole extension is missing.

You can ignore this warning and use "serve" commend to develop.

Create Dockerfile for Deployment

# Dockerfile

FROM xxutianyi/laravel-swoole:latest

COPY . /var/www/html
RUN cd /var/www/html \
    && composer install --optimize-autoloader --no-dev \
    && php artisan route:cache

RUN chmod 777 /var/www/html -R

Then build your app

$ docker build -t your-app-name:latest .

Run use docker compose on production machine

# docker-compose.yml

version: "3"
services:
    app:
        image: "your-app-name:latest"
        extra_hosts:
            - "host.docker.internal:host-gateway"
        ports:
            - "${APP_PORT:-8000}:8000"
            - "${VITE_PORT:-5173}:${VITE_PORT:-5173}"
        env_file:
            - ./.env
        environment:
            LARAVEL_SAIL: 1
            XDEBUG_MODE: "${SAIL_XDEBUG_MODE:-off}"
            XDEBUG_CONFIG: "${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}"
        networks:
            - sail  
    ...
    
networks:
    sail:
        driver: bridge

    ...

and run it

$ docker compose up
MIT License Copyright (c) 2023 徐添翼 XuTianyi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Deployment Docker image for Laravel Octane use Swoole 用于部署的docker镜像 展开 收起
Dockerfile 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/xxutianyi/docker-laravel-swoole.git
git@gitee.com:xxutianyi/docker-laravel-swoole.git
xxutianyi
docker-laravel-swoole
docker-laravel-swoole
main

搜索帮助