@@ -33,12 +33,12 @@ Tesseract OCR Lambda Layer
33
33
34
34
# Quickstart
35
35
36
- This repo comes with ready-to-use binaries compiled against the AWS Lambda Runtimes (based on Amazonlinux 1 ).
37
- Example Projects in Python 3.6 using Serverless Framework and CDK are provided:
36
+ This repo comes with ready-to-use binaries compiled against the AWS Lambda Runtimes (based on Amazon Linux 1 and 2 ).
37
+ Example Projects in Python 3.6 (& 3.8) using Serverless Framework and CDK are provided:
38
38
39
39
``` bash
40
40
# # Demo using Serverless Framework and prebuilt layer
41
- cd example/serverless-framework
41
+ cd example/serverless
42
42
npm ci
43
43
npx sls deploy
44
44
@@ -69,20 +69,19 @@ provider:
69
69
70
70
# define layer
71
71
layers :
72
- tesseractAl1 :
72
+ tesseractAl2 :
73
73
# and path to contents
74
- path : ready-to-use/amazonlinux-1
74
+ path : ready-to-use/amazonlinux-2
75
75
compatibleRuntimes :
76
- - python3.6
77
- - python3.7
76
+ - python3.8
78
77
79
78
functions :
80
79
tesseract-ocr :
81
80
handler : ...
82
- runtime : python3.6
81
+ runtime : python3.8
83
82
# reference layer in function
84
83
layers :
85
- - { Ref: TesseractAl1LambdaLayer }
84
+ - { Ref: TesseractAl2LambdaLayer }
86
85
events :
87
86
- http :
88
87
path : ocr
@@ -105,17 +104,17 @@ Reference the path to the layer contents in your constructs:
105
104
const app = new App ();
106
105
const stack = new Stack (app , ' tesseract-lambda-ci' );
107
106
108
- const al1Layer = new lambda .LayerVersion (stack , ' al1 -layer' , {
107
+ const al2Layer = new lambda .LayerVersion (stack , ' al2 -layer' , {
109
108
// reference the directory containing the ready-to-use layer
110
- code: Code .fromAsset (path .resolve (__dirname , ' ./ready-to-use/amazonlinux-1 ' )),
109
+ code: Code .fromAsset (path .resolve (__dirname , ' ./ready-to-use/amazonlinux-2 ' )),
111
110
description: ' AL1 Tesseract Layer' ,
112
111
});
113
- new lambda .Function (stack , ' python3.6 ' , {
112
+ new lambda .Function (stack , ' python38 ' , {
114
113
// reference the source code to your function
115
114
code: lambda .Code .fromAsset (path .resolve (__dirname , ' lambda-handlers' )),
116
- runtime: Runtime .PYTHON_3_6 ,
115
+ runtime: Runtime .PYTHON_3_8 ,
117
116
// add tesseract layer to function
118
- layers: [al1Layer ],
117
+ layers: [al2Layer ],
119
118
memorySize: 512 ,
120
119
timeout: Duration .seconds (30 ),
121
120
handler: ' handler.main' ,
0 commit comments