-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dimitri John Ledkov <[email protected]>
- Loading branch information
Showing
11 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!--monopod:start--> | ||
# tesseract | ||
| | | | ||
| - | - | | ||
| **OCI Reference** | `cgr.dev/chainguard/tesseract` | | ||
|
||
|
||
* [View Image in Chainguard Academy](https://edu.chainguard.dev/chainguard/chainguard-images/reference/tesseract/overview/) | ||
* [View Image Catalog](https://console.enforce.dev/images/catalog) for a full list of available tags. | ||
* [Contact Chainguard](https://www.chainguard.dev/chainguard-images) for enterprise support, SLAs, and access to older tags.* | ||
|
||
--- | ||
<!--monopod:end--> | ||
|
||
<!--overview:start--> | ||
Minimal image that contains tesseract | ||
<!--overview:end--> | ||
|
||
<!--getting:start--> | ||
## Download this Image | ||
The image is available on `cgr.dev`: | ||
|
||
``` | ||
docker pull cgr.dev/chainguard/tesseract:latest | ||
``` | ||
<!--getting:end--> | ||
|
||
<!--body:start--> | ||
# Usage | ||
|
||
tessaract sample Example: OCR a eurotext.png file to .txt | ||
|
||
``` | ||
docker run --rm \ | ||
-v "${PWD}":/work \ | ||
-w /work \ | ||
cgr.dev/chainguard/tesseract:latest | ||
eurotext.png - | ||
``` | ||
<!--body:end--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
terraform { | ||
required_providers { | ||
apko = { source = "chainguard-dev/apko" } | ||
} | ||
} | ||
|
||
variable "extra_packages" { | ||
description = "The additional packages to install" | ||
# Install tesseract itself, orientation & size & english datasets | ||
default = ["tesseract", "tesseract-osd", "tesseract-eng"] | ||
} | ||
|
||
data "apko_config" "this" { | ||
config_contents = file("${path.module}/template.apko.yaml") | ||
extra_packages = var.extra_packages | ||
} | ||
|
||
output "config" { | ||
value = jsonencode(data.apko_config.this.config) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
accounts: | ||
groups: | ||
- groupname: nonroot | ||
gid: 65532 | ||
users: | ||
- username: nonroot | ||
uid: 65532 | ||
gid: 65532 | ||
run-as: 65532 | ||
|
||
entrypoint: | ||
command: /usr/bin/tesseract | ||
|
||
cmd: --help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
terraform { | ||
required_providers { | ||
oci = { source = "chainguard-dev/oci" } | ||
} | ||
} | ||
|
||
variable "target_repository" { | ||
description = "The docker repo into which the image and attestations should be published." | ||
} | ||
|
||
module "latest-config" { source = "./config" } | ||
|
||
module "latest" { | ||
source = "../../tflib/publisher" | ||
|
||
name = basename(path.module) | ||
|
||
target_repository = var.target_repository | ||
config = module.latest-config.config | ||
build-dev = true | ||
} | ||
|
||
module "test-latest" { | ||
source = "./tests" | ||
digest = module.latest.image_ref | ||
} | ||
|
||
resource "oci_tag" "latest" { | ||
depends_on = [module.test-latest] | ||
digest_ref = module.latest.image_ref | ||
tag = "latest" | ||
} | ||
|
||
resource "oci_tag" "latest-dev" { | ||
depends_on = [module.test-latest] | ||
digest_ref = module.latest.dev_ref | ||
tag = "latest-dev" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: tesseract | ||
image: cgr.dev/chainguard/tesseract | ||
endoflife: "" | ||
console_summary: "" | ||
short_description: Minimal image that contains tesseract | ||
compatibility_notes: "" | ||
readme_file: README.md | ||
upstream_url: https://tesseract-ocr.github.io/ | ||
keywords: | ||
- application | ||
- tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
eurotext.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
## Using example image from | ||
## https://tesseract-ocr.github.io/tessdoc/images/eurotext.png | ||
|
||
set -o errexit -o nounset -o errtrace -o pipefail -x | ||
|
||
docker run --rm \ | ||
-v "${PWD}:/work" \ | ||
-w /work \ | ||
"${IMAGE_NAME}" \ | ||
eurotext.png - | diff -u eurotext.exp - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
The (quick) [brown] {fox} jumps! | ||
Over the $43,456.78 <lazy> #90 dog | ||
& duck/goose, as 12.5% of E-mail | ||
from [email protected] is spam. | ||
Der ,schnelle” braune Fuchs springt | ||
iiber den faulen Hund. Le renard brun | ||
«rapide» saute par-dessus le chien | ||
paresseux. La volpe marrone rapida | ||
salta sopra il cane pigro. El zorro | ||
marrén rapido salta sobre el perro | ||
perezoso. A raposa marrom ripida | ||
salta sobre o cdo preguigoso. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
terraform { | ||
required_providers { | ||
oci = { source = "chainguard-dev/oci" } | ||
} | ||
} | ||
|
||
variable "digest" { | ||
description = "The image digest to run tests over." | ||
} | ||
|
||
data "oci_exec_test" "help" { | ||
digest = var.digest | ||
script = "docker run --rm $IMAGE_NAME --help" | ||
} | ||
|
||
data "oci_exec_test" "convert" { | ||
digest = var.digest | ||
script = "./01-eurotext-ocr.sh" | ||
working_dir = path.module | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters