laravel11 笔记
小于 1 分钟
octane 使用
composer require laravel/octane
php artisan octane:install # swoole
php artisan octane:start --server=swoole --host=0.0.0.0 --port=8089
docker打包
dockerfile
FROM hyperf/hyperf:8.2-alpine-vedge-swoole-slim-v5
ENV TZ Asia/Shanghai
RUN apk add tzdata && cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone
WORKDIR /app
COPY . /app
RUN composer install --optimize-autoloader --prefer-dist
CMD ["php", "artisan", "octane:start", "--server=swoole", "--host=0.0.0.0", "--port=8089"]
docker-compose.yml
services:
app:
# image: registry.cn-hangzhou.aliyuncs.com/orangbus/math-api
build:
context: .
privileged: true
restart: unless-stopped
ports:
- "8089:8089"
volumes:
- ./.env:/app/.env
- ./storage:/app/storage
network_mode: bridge
command: php artisan octane:start --server=swoole --port=8089
queue:
image: registry.cn-hangzhou.aliyuncs.com/orangbus/math-api
restart: unless-stopped
volumes:
- .env:/app/.env
command: php artisan queue:work --tries=3
schedule:
image: registry.cn-hangzhou.aliyuncs.com/orangbus/math-api
restart: unless-stopped
volumes:
- .env:/app/.env
command: php artisan schedule:work
云效配置