I am trying to use a custom Dockerfile to build the LUIS container and copy the app file (app exported from the Luis portal) into the container. For this reason, I really don't need the mount points, since the .gz file will already live in the container. Is this possible? It seems that the mount points are always required...
I have to copy the files into the container and the move them to the input
location at runtime (using an init.sh script). But, even then the container seemed to not load the app correctly. It behaves differently from that scenario compared to just putting the file in the host folder and mounting that to the container.
UPDATE: When I try to move the files around internally (at the start of the container), LUIS gives this output:
Using '/input' for reading models and other read-only data.
Using '/output/luis/fbfb798892fd' for writing logs and other output data.
Logging to console.
Submitting metering to 'https://southcentralus.api.cognitive.microsoft.com/'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Overriding address(es) 'http://+:80'. Binding to endpoints defined in UseKestrel() instead.
Hosting environment: Production
Content root path: /app
Now listening on: http://0.0.0.0:5000
Application started. Press Ctrl+C to shut down.
fail: Luis[0]
Failed while prefetching App: AppId: d6fa5fd3-c32a-44d5-bb7f-d563775cf6ee - Slot: PRODUCTION Could not find file '/input/d6fa5fd3-c32a-44d5-bb7f-d563775cf6ee_PRODUCTION.gz'.
fail: Luis[0]
Failed while getting response for AppId: d6fa5fd3-c32a-44d5-bb7f-d563775cf6ee - Slot: PRODUCTION. Error: Could not find file '/input/d6fa5fd3-c32a-44d5-bb7f-d563775cf6ee_PRODUCTION.gz'.
warn: Microsoft.CloudAI.Containers.Controllers.LuisControllerV3[0]
Response status code: 404
Exception: Could not find file '/input/d6fa5fd3-c32a-44d5-bb7f-d563775cf6ee_PRODUCTION.gz'. SubscriptionId='' RequestId='d7dfee25-05d9-4af6-804d-58558f55465e' Timestamp=''
^C
nuc@nuc-NUC8i7BEK:/tmp/input$ sudo docker exec -it luis bash
root@fbfb798892fd:/app# cd /input
root@fbfb798892fd:/input# ls
d6fa5fd3-c32a-44d5-bb7f-d563775cf6ee_production.gz
root@fbfb798892fd:/input# ls -l
total 8
-rwxrwxrwx 1 root root 4960 Dec 2 17:35 d6fa5fd3-c32a-44d5-bb7f-d563775cf6ee_production.gz
root@fbfb798892fd:/input#
Notice that even though I can log into the container and browse the location of the model files and they are present, LUIS cannot load/find them.
UPDATE #2 - posting my Dockerfile:
FROM mcr.microsoft.com/azure-cognitive-services/luis:latest
ENV Eula=accept
ENV Billing=https://southcentralus.api.cognitive.microsoft.com/
ENV ApiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ENV Logging:Console:LogLevel:Default=Debug
RUN mkdir /app/inputfiles/
RUN chmod 777 /app/inputfiles/
COPY *.gz /app/inputfiles/
WORKDIR /app
COPY init.sh .
RUN chmod 777 /app/init.sh
ENTRYPOINT /app/init.sh && dotnet Microsoft.CloudAI.Containers.Luis.dll
The models can be COPY
'd directly into /input/
.
e.g.
FROM mcr.microsoft.com/azure-cognitive-services/luis:latest
COPY *.gz /input/
This will work, but requires that you don't mount to /input at runtime as it will squash the COPY
'd files. The message "A folder must be mounted" is only logged if the /input
directory does not exist.
> docker build . -t luis --no-cache
Sending build context to Docker daemon 40.43MB
Step 1/2 : FROM aicpppe.azurecr.io/microsoft/cognitive-services-luis
---> df4e32e45b1e
Step 2/2 : COPY ./*.gz /input/
---> c5f41a9d8522
Successfully built c5f41a9d8522
Successfully tagged luis:latest
> docker run --rm -it -p 5000:5000 luis eula=accept billing=*** apikey=***
...
Using '/input' for reading models and other read-only data.
...
Application started. Press Ctrl+C to shut down.
The configuration value Mounts:Input
can be set to configure the input location.
This might be useful if you need your models to live in /app/inputfiles
or if you need to mount to /input
for another reason at runtime.
e.g.
FROM aicpppe.azurecr.io/microsoft/cognitive-services-luis
ENV Mounts:Input=/app/inputfiles
COPY ./*.gz /app/inputfiles/
This results in:
> docker build . -t luis --no-cache
Sending build context to Docker daemon 40.43MB
Step 1/3 : FROM aicpppe.azurecr.io/microsoft/cognitive-services-luis
---> df4e32e45b1e
Step 2/3 : ENV Mounts:Input=/app/inputfiles
---> Running in b6029a2b54d0
Removing intermediate container b6029a2b54d0
---> cb9a4e06463b
Step 3/3 : COPY ./*.gz /app/inputfiles/
---> 9ab1dfaa36e7
Successfully built 9ab1dfaa36e7
Successfully tagged luis:latest
> docker run --rm -it -p 5000:5000 luis eula=accept billing=*** apikey=***
...
Using '/app/inputfiles' for reading models and other read-only data.
...
Application started. Press Ctrl+C to shut down.