Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/umihico/laravel-lambda-docker-bref
Demo Laravel application on AWS Lambda function with Docker container image using Bref
https://github.com/umihico/laravel-lambda-docker-bref
Last synced: about 2 months ago
JSON representation
Demo Laravel application on AWS Lambda function with Docker container image using Bref
- Host: GitHub
- URL: https://github.com/umihico/laravel-lambda-docker-bref
- Owner: umihico
- Created: 2021-02-23T03:35:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-30T07:01:22.000Z (almost 4 years ago)
- Last Synced: 2024-05-01T14:34:53.353Z (8 months ago)
- Language: PHP
- Homepage: https://w0qw04g8sj.execute-api.ap-northeast-1.amazonaws.com/
- Size: 80.1 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
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
```Dockerfile:Dockerfile
FROM bref/php-80-fpm
COPY . /var/task
CMD [ "public/index.php" ]
``````diff:serverless.yml
service: laravelprovider:
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.al2ecr:
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!
```bash
sls deploy --region ap-northeast-1 # use your region
```### References
- https://aws.amazon.com/jp/blogs/compute/building-php-lambda-functions-with-docker-container-images/
- https://bref.sh/docs/frameworks/laravel.html
- https://laravel.com/docs/8.x/installation
- https://laravel.com/docs/8.x/sail#introduction
- https://please-sleep.cou929.nu/bash-strict-mode.html