Skip to content

Commit 81e242d

Browse files
committed
add deprecation warnings for code and examples based on al1
1 parent e09144b commit 81e242d

29 files changed

+92
-82
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Tesseract OCR Lambda Layer
1212

1313
> AWS Lambda layer containing the [tesseract OCR](https://github.com/tesseract-ocr/tesseract) libraries and command-line binary for Lambda Runtimes running on Amazon Linux 1 and 2.
1414
15+
> :warning: [The Amazon Linux AMI (Version 1) is being deprecated](https://aws.amazon.com/blogs/aws/update-on-amazon-linux-ami-end-of-life/). Users are advised to not use Lambda runtimes (i.e. Python 3.6) based on this version. Refer also to the [AWS Lambda runtime deprecation policy](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-support-policy).
16+
1517
<!-- TOC -->
1618

1719
- [Tesseract OCR Lambda Layer](#tesseract-ocr-lambda-layer)
@@ -108,7 +110,7 @@ const stack = new Stack(app, 'tesseract-lambda-ci');
108110
const al2Layer = new lambda.LayerVersion(stack, 'al2-layer', {
109111
// reference the directory containing the ready-to-use layer
110112
code: Code.fromAsset(path.resolve(__dirname, './ready-to-use/amazonlinux-2')),
111-
description: 'AL1 Tesseract Layer',
113+
description: 'AL2 Tesseract Layer',
112114
});
113115
new lambda.Function(stack, 'python38', {
114116
// reference the source code to your function
@@ -142,10 +144,10 @@ unset CONTAINER
142144

143145
## available `Dockerfile`s
144146

145-
| Dockerfile | Base-Image | compatible Runtimes |
146-
|:-----------------|:---------------|:----------------------------------------------------------------------|
147-
| `Dockerfile.al1` | Amazon Linux 1 | Python 2.7/3.6/3.7, Ruby 2.5, Java 8 (OpenJDK), Go 1.x, .NET Core 2.1 |
148-
| `Dockerfile.al2` | Amazon Linux 2 | Python 3.8, Ruby 2.7, Java 8/11 (Coretto), .NET Core 3.1 |
147+
| Dockerfile | Base-Image | compatible Runtimes |
148+
| :-------------------------------------- | :------------- | :-------------------------------------------------------------------- |
149+
| `Dockerfile.al1` (:warning: deprecated) | Amazon Linux 1 | Python 2.7/3.6/3.7, Ruby 2.5, Java 8 (OpenJDK), Go 1.x, .NET Core 2.1 |
150+
| `Dockerfile.al2` | Amazon Linux 2 | Python 3.8, Ruby 2.7, Java 8/11 (Coretto), .NET Core 3.1 |
149151

150152

151153
## Building a different tesseract version and/or language
@@ -155,21 +157,21 @@ Per default the build generates the [tesseract 4.1.3](https://github.com/tessera
155157
The build process can be modified using different build time arguments (defined as `ARG` in `Dockerfile.al[1|2]`), using the `--build-arg` option of `docker build`.
156158

157159
| Build-Argument | description | available versions |
158-
|:-------------------------|:------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------|
160+
| :----------------------- | :---------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- |
159161
| `TESSERACT_VERSION` | the tesseract OCR engine | https://github.com/tesseract-ocr/tesseract/releases |
160162
| `LEPTONICA_VERSION` | fundamental image processing and analysis library | https://github.com/danbloomberg/leptonica/releases |
161163
| `OCR_LANG` | Language to install (in addition to `eng` and `osd`) | https://github.com/tesseract-ocr/tessdata (`<lang>.traineddata`) |
162164
| `TESSERACT_DATA_SUFFIX` | Trained LSTM models for tesseract. Can be empty (default), `_best` (best inference) and `_fast` (fast inference). | https://github.com/tesseract-ocr/tessdata, https://github.com/tesseract-ocr/tessdata_best, https://github.com/tesseract-ocr/tessdata_fast |
163-
| `TESSERACT_DATA_VERSION` | Version of the trained LSTM models for tesseract. (currently - in July 2022 - only `4.1.0` is available) | https://github.com/tesseract-ocr/tessdata/releases/tag/4.1.0 |
165+
| `TESSERACT_DATA_VERSION` | Version of the trained LSTM models for tesseract. (currently - in July 2022 - only `4.1.0` is available) | https://github.com/tesseract-ocr/tessdata/releases/tag/4.1.0 |
164166

165167

166168
**Example of custom build**
167169

168170
```bash
169-
## Build a Dockerimage based on Amazon Linux 1, with Tesseract 4.0.0
170-
docker build --build-arg TESSERACT_VERSION=4.0.0 --build-arg OCR_LANG=fra -t tesseract-lambda-layer -f Dockerfile.al1 .
171171
## Build a Dockerimage based on Amazon Linux 2, with French language support
172172
docker build --build-arg OCR_LANG=fra -t tesseract-lambda-layer-french -f Dockerfile.al2 .
173+
## Build a Dockerimage based on Amazon Linux 2, with Tesseract 4.0.0 and french language support
174+
docker build --build-arg TESSERACT_VERSION=4.0.0 --build-arg OCR_LANG=fra -t tesseract-lambda-layer -f Dockerfile.al2 .
173175
```
174176

175177
## Deployment size optimization

example/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
Examples
22
===
33

4-
| Lambda Runtime | Amazon Linux | IaC framework | example |
5-
|:---------------|:------------:|:---------------------|:------------------|
6-
| Python 3.6 | 1 | serverless framework | [`serverless`](./serverless) |
7-
| Python 3.6 | 1 | AWS CDK | [`cdk`](./cdk) |
8-
| Python 3.8 | 2 | serverless framework | [`al2-serverless`](./al2-serverless) |
9-
| Python 3.8 | 2 | AWS CDK | [`al2-cdk`](./al2-cdk) |
4+
| Lambda Runtime | Amazon Linux | IaC framework | example |
5+
| :------------------- | :----------: | :------------------- | :----------------------------------- |
6+
| Python 3.8 | 2 | serverless framework | [`al2-serverless`](./al2-serverless) |
7+
| Python 3.8 | 2 | AWS CDK | [`al2-cdk`](./al2-cdk) |

example/al1-deprecated/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Examples
2+
===
3+
4+
> :warning: these examples are using old and deprecated versions of runtimes
5+
6+
| Lambda Runtime | Amazon Linux | IaC framework | example |
7+
| :------------- | :----------: | :------------------- | :--------------------------- |
8+
| Python 3.6 | 1 | serverless framework | [`serverless`](./serverless) |
9+
| Python 3.6 | 1 | AWS CDK | [`cdk`](./cdk) |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example: AWS Lambda with Tesseract layer (Amazon Linux 2 based runtime - Python 3.8)
1+
Example: AWS Lambda with Tesseract layer (Amazon Linux 1 based runtime - Python 3.6)
22
===
33

44
### Requirements
@@ -23,7 +23,7 @@ npx cdk deploy
2323

2424
```bash
2525
curl -X POST \
26-
https://16ary8rftd.execute-api.eu-central-1.amazonaws.com/prod/ocr \
26+
https://i61tt4wbth.execute-api.eu-central-1.amazonaws.com/dev/ocr \
2727
-d https://upload.wikimedia.org/wikipedia/de/e/eb/Goethe_Faust_Textbeispiel_Grossschreibung.png
2828
```
2929

167 KB
Loading
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ import { App, BundlingDockerImage, Duration, Stack } from '@aws-cdk/core';
66

77

88
const app = new App();
9-
const stack = new Stack(app, 'tesseract-ocr-example-cdk-py38');
9+
const stack = new Stack(app, 'tesseract-ocr-example-cdk-py36');
1010

1111
/**
12-
* Artifacts for AL 2
12+
* Artifacts for AL 1
1313
*/
14-
const al2Layer = new lambda.LayerVersion(stack, 'al2-layer', {
15-
code: Code.fromAsset(path.resolve(__dirname, '../../ready-to-use/amazonlinux-2')),
16-
description: 'AL2 Tesseract Layer',
14+
const al1Layer = new lambda.LayerVersion(stack, 'al1-layer', {
15+
code: Code.fromAsset(path.resolve(__dirname, '../../ready-to-use/amazonlinux-1')),
16+
description: 'AL1 Tesseract Layer',
1717
});
1818

19-
const ocrFn = new lambda.Function(stack, 'python3.8', {
19+
const ocrFn = new lambda.Function(stack, 'python3.6', {
2020
code: lambda.Code.fromAsset(path.resolve(__dirname, 'lambda-handlers'),
2121
{
2222
bundling: {
23-
image: BundlingDockerImage.fromRegistry('lambci/lambda:build-python3.8'),
23+
image: BundlingDockerImage.fromRegistry('lambci/lambda:build-python3.6'),
2424
command: ['/bin/bash', '-c', [
2525
'pip install -r requirements.txt -t /asset-output/',
2626
'cp handler.py /asset-output',
2727
].join(' && ')],
2828
}
2929
}),
30-
runtime: Runtime.PYTHON_3_8,
31-
layers: [al2Layer],
30+
runtime: Runtime.PYTHON_3_6,
31+
layers: [al1Layer],
3232
memorySize: 1024,
3333
timeout: Duration.seconds(10),
3434
handler: 'handler.main',
File renamed without changes.

example/al2-cdk/lambda-handlers/requirements.txt renamed to example/al1-deprecated/cdk/lambda-handlers/requirements.txt

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)