Skip to content

Commit bd76005

Browse files
Merge pull request #2446 from laujan/jaep-2437
Jaep 2437
2 parents b078024 + 3e6398c commit bd76005

File tree

1 file changed

+128
-29
lines changed

1 file changed

+128
-29
lines changed

articles/ai-services/document-intelligence/containers/install-run.md

Lines changed: 128 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Install and run Docker containers for Document Intelligence
2+
title: Install and run Docker containers for Document Intelligence
33
titleSuffix: Azure AI services
44
description: Use the Docker containers for Document Intelligence on-premises to identify and extract key-value pairs, selection marks, tables, and structure from forms and documents.
55
author: laujan
66
manager: nitinme
77
ms.service: azure-ai-document-intelligence
88
ms.topic: how-to
9-
ms.date: 11/19/2024
9+
ms.date: 01/22/2025
1010
ms.author: lajanuar
1111
---
1212

@@ -272,13 +272,13 @@ services:
272272
- AzureCognitiveServiceReadHost=http://azure-cognitive-service-read:5000
273273
ports:
274274
- "5000:5050"
275-
azure-cognitive-service-read:
276-
container_name: azure-cognitive-service-read
277-
image: mcr.microsoft.com/azure-cognitive-services/form-recognizer/read-3.1
278-
environment:
279-
- EULA=accept
280-
- billing={FORM_RECOGNIZER_ENDPOINT_URI}
281-
- apiKey={FORM_RECOGNIZER_KEY}
275+
azure-cognitive-service-read:
276+
container_name: azure-cognitive-service-read
277+
image: mcr.microsoft.com/azure-cognitive-services/form-recognizer/read-3.1
278+
environment:
279+
- EULA=accept
280+
- billing={FORM_RECOGNIZER_ENDPOINT_URI}
281+
- apiKey={FORM_RECOGNIZER_KEY}
282282
```
283283
284284
Now, you can start the service with the [**docker compose**](https://docs.docker.com/compose/) command:
@@ -345,6 +345,7 @@ services:
345345
- apiKey={FORM_RECOGNIZER_KEY}
346346
```
347347
348+
348349
### [Custom](#tab/custom)
349350
350351
In addition to the [prerequisites](#prerequisites), you need to do the following to process a custom document:
@@ -385,23 +386,25 @@ In addition to the [prerequisites](#prerequisites), you need to do the following
385386

386387
1. Declare the following environment variables:
387388

388-
```text
389+
```bash
390+
391+
389392
SHARED_MOUNT_PATH="./share"
390393
OUTPUT_MOUNT_PATH="./output"
391394
FILE_MOUNT_PATH="./files"
392395
DB_MOUNT_PATH="./db"
393396
FORM_RECOGNIZER_ENDPOINT_URI="YourFormRecognizerEndpoint"
394397
FORM_RECOGNIZER_KEY="YourFormRecognizerKey"
395398
NGINX_CONF_FILE="./nginx.conf"
396-
```
399+
```
397400

398401
#### Create an **nginx** file
399402

400403
1. Name this file **nginx.conf**.
401404

402405
1. Enter the following configuration:
403406

404-
```text
407+
```bash
405408
worker_processes 1;
406409
407410
events { worker_connections 1024; }
@@ -443,6 +446,10 @@ http {
443446
proxy_pass http://docker-custom/swagger;
444447
}
445448
449+
location /api-docs {
450+
proxy_pass http://docker-custom/api-docs;
451+
}
452+
446453
location /formrecognizer/documentModels/prebuilt-layout {
447454
proxy_set_header Host $host:$server_port;
448455
proxy_set_header Referer $scheme://$host:$server_port;
@@ -491,6 +498,9 @@ http {
491498
}
492499
493500
```
501+
::: moniker-end
502+
503+
:::moniker range="<=doc-intel-3.0.0"
494504

495505
#### Create a **docker compose** file
496506

@@ -506,7 +516,94 @@ services:
506516
container_name: reverseproxy
507517
depends_on:
508518
- layout
509-
- custom-template
519+
- custom-template
520+
volumes:
521+
- ${NGINX_CONF_FILE}:/etc/nginx/nginx.conf
522+
ports:
523+
- "5000:5000"
524+
layout:
525+
container_name: azure-cognitive-service-layout
526+
image: mcr.microsoft.com/azure-cognitive-services/form-recognizer/layout-3.0:latest
527+
environment:
528+
eula: accept
529+
apikey: ${FORM_RECOGNIZER_KEY}
530+
billing: ${FORM_RECOGNIZER_ENDPOINT_URI}
531+
Logging:Console:LogLevel:Default: Information
532+
SharedRootFolder: /share
533+
Mounts:Shared: /share
534+
Mounts:Output: /logs
535+
volumes:
536+
- type: bind
537+
source: ${SHARED_MOUNT_PATH}
538+
target: /share
539+
- type: bind
540+
source: ${OUTPUT_MOUNT_PATH}
541+
target: /logs
542+
expose:
543+
- "5000"
544+
545+
custom-template:
546+
container_name: azure-cognitive-service-custom-template
547+
image: mcr.microsoft.com/azure-cognitive-services/form-recognizer/custom-template-3.0:latest
548+
restart: always
549+
depends_on:
550+
- layout
551+
environment:
552+
AzureCognitiveServiceLayoutHost: http://azure-cognitive-service-layout:5000
553+
eula: accept
554+
apikey: ${FORM_RECOGNIZER_KEY}
555+
billing: ${FORM_RECOGNIZER_ENDPOINT_URI}
556+
Logging:Console:LogLevel:Default: Information
557+
SharedRootFolder: /share
558+
Mounts:Shared: /share
559+
Mounts:Output: /logs
560+
volumes:
561+
- type: bind
562+
source: ${SHARED_MOUNT_PATH}
563+
target: /share
564+
- type: bind
565+
source: ${OUTPUT_MOUNT_PATH}
566+
target: /logs
567+
expose:
568+
- "5000"
569+
570+
studio:
571+
container_name: form-recognizer-studio
572+
image: mcr.microsoft.com/azure-cognitive-services/form-recognizer/studio:3.0
573+
environment:
574+
ONPREM_LOCALFILE_BASEPATH: /onprem_folder
575+
STORAGE_DATABASE_CONNECTION_STRING: /onprem_db/Application.db
576+
volumes:
577+
- type: bind
578+
source: ${FILE_MOUNT_PATH} # path to your local folder
579+
target: /onprem_folder
580+
- type: bind
581+
source: ${DB_MOUNT_PATH} # path to your local folder
582+
target: /onprem_db
583+
ports:
584+
- "5001:5001"
585+
user: "1000:1000" # echo $(id -u):$(id -g)
586+
587+
```
588+
::: moniker-end
589+
590+
:::moniker range=">=doc-intel-3.1.0"
591+
592+
#### Create a **docker compose** file
593+
594+
1. Name this file **docker-compose.yml**
595+
596+
2. The following code sample is a self-contained `docker compose` example to run Document Intelligence Layout, Studio, and Custom template containers together. With `docker compose`, you use a YAML file to configure your application's services. Then, with `docker-compose up` command, you create and start all the services from your configuration.
597+
598+
```yml
599+
version: '3.3'
600+
services:
601+
nginx:
602+
image: nginx:alpine
603+
container_name: reverseproxy
604+
depends_on:
605+
- layout
606+
- custom-template
510607
volumes:
511608
- ${NGINX_CONF_FILE}:/etc/nginx/nginx.conf
512609
ports:
@@ -559,7 +656,7 @@ services:
559656
560657
studio:
561658
container_name: form-recognizer-studio
562-
image: mcr.microsoft.com/azure-cognitive-services/form-recognizer/studio:3.0
659+
image: mcr.microsoft.com/azure-cognitive-services/form-recognizer/studio:3.1
563660
environment:
564661
ONPREM_LOCALFILE_BASEPATH: /onprem_folder
565662
STORAGE_DATABASE_CONNECTION_STRING: /onprem_db/Application.db
@@ -575,6 +672,7 @@ services:
575672
user: "1000:1000" # echo $(id -u):$(id -g)
576673
577674
```
675+
::: moniker-end
578676

579677
The custom template container and Layout container can use Azure Storage queues or in memory queues. The `Storage:ObjectStore:AzureBlob:ConnectionString` and `queue:azure:connectionstring` environment variables only need to be set if you're using Azure Storage queues. When running locally, delete these variables.
580678

@@ -635,20 +733,21 @@ $b64String = [System.Convert]::ToBase64String($bytes, [System.Base64FormattingOp
635733
Use the build model API to post the request.
636734

637735
```http
638-
POST http://localhost:5000/formrecognizer/documentModels:build?api-version=2023-07-31
639-
640-
{
641-
"modelId": "mymodel",
642-
"description": "test model",
643-
"buildMode": "template",
644-
645-
"base64Source": "<Your base64 encoded string>",
646-
"tags": {
647-
"additionalProp1": "string",
648-
"additionalProp2": "string",
649-
"additionalProp3": "string"
650-
}
651-
}
736+
737+
POST http://localhost:5000/formrecognizer/documentModels:build?api-version=2023-07-31
738+
739+
{
740+
"modelId": "mymodel",
741+
"description": "test model",
742+
"buildMode": "template",
743+
744+
"base64Source": "<Your base64 encoded string>",
745+
"tags": {
746+
"additionalProp1": "string",
747+
"additionalProp2": "string",
748+
"additionalProp3": "string"
749+
}
750+
}
652751
```
653752

654753
---
@@ -720,4 +819,4 @@ That's it! In this article, you learned concepts and workflows for downloading,
720819
* [Document Intelligence container configuration settings](configuration.md)
721820

722821
* [Azure container instance recipe](../../../ai-services/containers/azure-container-instance-recipe.md)
723-
::: moniker-end
822+

0 commit comments

Comments
 (0)