From 1853abe7f9ee806024df5784d616197b0f2a8726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Lebrun?= Date: Tue, 1 Oct 2024 15:56:01 +0200 Subject: [PATCH] README: fix docker image instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two issues are fixed: - Initial `docker build` instructions fail because the Dockerfile path is wrong (elixir/Dockerfile versus elixir/docker/Dockerfile). - Indexing instructions are wrong because they do not use the virtualenv Python. It contains the installed packages, which we need for indexing. Issue appears as: ModuleNotFoundError: No module named 'bsddb3' (edited) We also remove some common Docker knowledge (why we might want the database to be coming from a mounted volume, rather than stored inside the container). Finally, we fix line widths but splitting commands into multiple lines. Signed-off-by: Théo Lebrun --- README.adoc | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/README.adoc b/README.adoc index 9be4f0d..adc1a9a 100644 --- a/README.adoc +++ b/README.adoc @@ -286,28 +286,36 @@ where all repositories are found. = Building Docker images -Dockerfiles are provided in the `docker/` directory. To build the image, run the following commands: +Dockerfiles are provided in the `docker/` directory. +To build the image, run the following commands: - # git clone https://github.com/bootlin/elixir.git ./elixir - # docker build -t elixir -f ./elixir/Dockerfile ./elixir + # git clone https://github.com/bootlin/elixir + # docker build -t elixir -f ./elixir/docker/Dockerfile ./elixir/ You can then run the image using `docker run`. -It is recommended to mount a volume or a host directory into the Elixir data directory. -This allows you to easily replace the container with a new version without losing indexing data. +Here we mount a host directory as Elixir data: # mkdir ./elixir-data # docker run -v ./elixir-data/:/srv/elixir-data -d --name elixir-container elixir -The Docker image does not contain any repositories. To index a repository, you can use a utility script - index-repository. -For example, to add musl repository, run: +The Docker image does not contain any repositories. +To index a repository, you can use the `index-repository` script. +For example, to add the https://musl.libc.org/[musl] repository, run: - # docker exec -it -e PYTHONUNBUFFERED=1 elixir-container /usr/local/elixir/utils/index-repository musl https://git.musl-libc.org/git/musl + # docker exec -it -e PYTHONUNBUFFERED=1 elixir-container \ + /bin/bash -c 'export "PATH=/usr/local/elixir/venv/bin:$PATH" ; \ + /usr/local/elixir/utils/index-repository \ + musl https://git.musl-libc.org/git/musl' Without PYTHONUNBUFFERED environment variable, update logs may show up with a delay. Or, to run indexing in a separate container: - # docker run -e PYTHONUNBUFFERED=1 -v ./elixir-data/:/srv/elixir-data --entrypoint /usr/local/elixir/utils/index-repository elixir musl https://git.musl-libc.org/git/musl + # docker run -e PYTHONUNBUFFERED=1 -v ./elixir-data/:/srv/elixir-data \ + --entrypoint /bin/bash elixir -c \ + 'export "PATH=/usr/local/elixir/venv/bin:$PATH" ; \ + /usr/local/elixir/utils/index-repository \ + musl https://git.musl-libc.org/git/musl' You can also use utils/index-all-repositories to start indexing all officially supported repositories.