Skip to content

Instantly share code, notes, and snippets.

@karenirenecano
Last active December 15, 2021 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karenirenecano/425d6baf83fd935dafc644906429415d to your computer and use it in GitHub Desktop.
Save karenirenecano/425d6baf83fd935dafc644906429415d to your computer and use it in GitHub Desktop.
PHP Serverless.yml
service: template-serverless-service
variablesResolutionMode: 20210326
provider:
name: aws
memorySize: 1024
# The AWS region in which to deploy (us-east-1 is the default)
region: us-east-1
# The stage of the application, e.g. dev, production, staging… ('dev' is the default)
stage: dev
runtime: provided.al2
lambdaHashingVersion: 20201221
package:
# Directories to exclude from deployment
exclude:
- node_modules/**
- public/storage
- resources/assets/**
- storage/**
- tests/**
functions:
# This function runs the Laravel website/API
web:
handler: public/index.php
reservedConcurrency: 2
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
layers:
- ${bref:layer.php-80-fpm}
events:
- http: 'ANY /'
- http: 'ANY /{proxy+}'
# This function lets us run artisan commands in Lambda
artisan:
handler: artisan
reservedConcurrency: 2
timeout: 120 # in seconds
layers:
- ${bref:layer.php-80} # PHP
- ${bref:layer.console} # The "console" layer
plugins:
# We need to include the Bref plugin
- ./vendor/bref/bref
- serverless-prune-plugin
custom:
prune:
automatic: true
number: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment