Skip to content

envomer/laravel-lambda-docker-bref

 
 

Repository files navigation

Delpoy Laravel on AWS Lambda with Docker using Bref

Step 1. Create your project

curl -s https://laravel.build/larademo | bash

Step 2. install requirements and generate serverless.yml

cd larademo
./vendor/bin/sail up -d
./vendor/bin/sail composer require bref/bref bref/laravel-bridge
./vendor/bin/sail php artisan vendor:publish --tag=serverless-config
./vendor/bin/sail down

Step 3. Create Dockerfile and modify serverless.yml

FROM bref/php-80-fpm
COPY . /var/task
CMD [ "public/index.php" ]
service: laravel

provider:
    name: aws
    # The AWS region in which to deploy (us-east-1 is the default)
    region: {opt:region, us-east-1}
    # The stage of the application, e.g. dev, production, staging… ('dev' is the default)
    stage: dev
    runtime: provided.al2

    ecr:
        images:
            laravel:
                path: ./
package:
    # Directories to exclude from deployment
    exclude:
        - node_modules/**
        - public/storage
        - resources/assets/**
        - storage/**
        - tests/**

functions:
    # This function runs the Laravel website/API
    web:
        image:
            name: laravel
        events:
            -   httpApi: '*'

Step 4. Deploy!

sls deploy --region ap-northeast-1 # use your region

References

About

Demo Laravel application on AWS Lambda function with Docker container image using Bref

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 80.4%
  • Blade 18.2%
  • Shell 1.3%
  • Dockerfile 0.1%