-1

感谢 AWS Lambda 和 Symfony Bref,我想部署我的 Symfony 4 网站,我遵循了这个文档:

但我有这个错误:

在此处输入图像描述

我的 serverless.yaml 文件:

service: bref-symfony

package:
    exclude:
        - node_modules/**
        - venv/**

provider:
    name: aws
    region: eu-west-3
    runtime: provided
    environment:
        # Symfony environment variables
        APP_ENV: prod

plugins:
    - ./vendor/bref/bref

functions:
    website:
        handler: public/index.php
        timeout: 30 # in seconds (API Gateway has a timeout of 30 seconds)
        layers:
            - ${bref:layer.php-73-fpm}
        events:
            -   http: 'ANY /'
            -   http: 'ANY /{proxy+}'
    console:
        handler: bin/console
        timeout: 120 # in seconds
        layers:
            - ${bref:layer.php-73} # PHP
            - ${bref:layer.console} # The "console" layer

请问是什么问题?

4

1 回答 1

1

看起来您需要减少应用映像中包含的内容。确保你在 composer 上运行 prod-only 依赖项:

composer inst --no-dev -o

你也可以在你的 serverless.yaml 中添加这样的东西,只包含运行 Symfony 应用程序所需的文件:

package:
    exclude:
        - '*'
        - '**'
    include:
        - 'bin/**'
        - 'config/**'
        - 'public/index.php'
        - 'src/**'
        - 'var/cache/prod/**'
        - 'translations/**'
        - 'vendor/**'
        - '.env'
于 2019-09-03T02:27:38.473 回答