| org: eagle | |
| app: text-captcha | |
| service: text-captcha | |
| frameworkVersion: "3" | |
| useDotenv: true | |
| # Note: We can set region and stag from commandline | |
| # `$ serverless deploy --region us-east-1 --stage production` | |
| provider: | |
| # architecture: arm64 | |
| name: aws | |
| region: ${opt:region, 'ap-northeast-1'} | |
| stage: ${opt:stage, 'development'} | |
| runtime: python3.10 | |
| logRetentionInDays: 30 | |
| ecr: | |
| images: | |
| appimage: | |
| path: ./ | |
| functions: | |
| lambda_function: | |
| # handler: handler.lambda_function | |
| image: | |
| name: appimage | |
| timeout: 90 | |
| memorySize: 4096 | |
| environment: | |
| # On Lambda, the default location is not writable. Only the "/tmp" folder is writable. Therefore, we need to set the cache location inside "/tmp". | |
| TORCH_HOME: /tmp/.ml_cache | |
| HF_HUB_CACHE: /tmp/.ml_cache/huggingface | |
| custom: | |
| warmup: | |
| MLModelWarmer: | |
| enabled: true | |
| events: | |
| - schedule: rate(4 minutes) | |
| concurrency: ${env:WARMER_CONCURRENCY, 2} | |
| verbose: false | |
| timeout: 100 | |
| payload: | |
| source: KEEP_LAMBDA_WARM | |
| plugins: | |
| - serverless-plugin-warmup | |