Commit f17deaa9 authored by Merlijn Wajer's avatar Merlijn Wajer
Browse files

doc/index: add some docker example steps

parent 8920a58e
......@@ -75,10 +75,76 @@ There is also this example repository, which is not python-specific:
https://git.archive.org/www/serverless
Including the module in your container
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build your module with Docker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From the root directory of your project, run these steps:
1. Create a Dockerfile, for example::
cat > Dockerfile
FROM alpine:3.13
RUN apk add py3-pip
RUN apk add libxml2-utils # for xmllint tool
RUN mkdir -p app
WORKDIR /app
RUN apk add py3-lxml py3-xmltodict
ADD main.py /app
ADD docker-bin/derivermodule-0.0.1-py3-none-any.whl /app/bin/
RUN pip3 install -U /app/bin/derivermodule-0.0.1-py3-none-any.whl
CMD python3 main.py
2. Build a wheel from `derivermodule` using::
python3 setup.py bdist_wheel
3. Copy the wheel to your project, in docker-bin::
mkdir docker-bin
cp -v /path/to/derivermodule/dist/*.whl docker-bin
4. Create ``main.py``
5. Build the container::
sudo docker build -t example-container .
Running your module with Docker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From the root directory of your project, run these steps:
1. ``mkdir -p items/my_identifier/{task,item}``
2. Place ``my_identifier_meta.xml`` and any other requires files in
``items/my_identifier/item``.
3. Create ``items/my_identifier/task/task.json`` with something like this::
cat > items/my_identifier/task/task.json
{
"identifier" : "my_identifier",
"sourceFile" : "/item/my_identifier_chocr.html.gz",
"sourceFormat" : "Character hOCR GZ",
"targetFile" : "/item/my_identifier_hocr.html.gz",
"targetFormat" : "hOCR GZ",
"task" : {
"args" : {}
}
}
4. Run the container::
sudo docker run -v `pwd`/items/my_identifier/task:/task -v `pwd`/items/my_identifier/item:/item -i -t example-container
TDB
Components
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment