nim-codex/docker
Ben Bierens 750fe2392f
Adds option to automatically announce codex by its public IP (#621)
* Adds option to automatically announce codex by its public IP

* Review comments by Slava

* Make NAT_PUBLIC_IP_AUTO more verbose and error resistant

Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>

---------

Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>
Co-authored-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>
2023-11-17 13:48:25 +00:00
..
README.md Enable codex_enable_api_debug_peers (#471) (#474) 2023-07-10 16:15:06 +03:00
codex.Dockerfile Adds option to automatically announce codex by its public IP (#621) 2023-11-17 13:48:25 +00:00
docker-compose.yaml Adds option to automatically announce codex by its public IP (#621) 2023-11-17 13:48:25 +00:00
docker-entrypoint.sh Adds option to automatically announce codex by its public IP (#621) 2023-11-17 13:48:25 +00:00

README.md

Codex Docker Image

Codex provides pre-built docker images and they are stored in the codexstorage/nim-codex repository.

Run

We can run Codex Docker image using CLI

# Default run
docker run --rm codexstorage/nim-codex

# Mount local datadir
docker run -v ./datadir:/datadir --rm codexstorage/nim-codex codex --data-dir=/datadir

And Docker Compose

# Run in detached mode
docker-compose up -d

Arguments

Docker image is based on the codex.Dockerfile and there is

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["codex"]

It means that at the image run it will just run codex application without any arguments and we can pass them as a regular arguments, by overriding command

docker run codexstorage/nim-codex codex --api-bindaddr=0.0.0.0 --api-port=8080

Environment variables

We can configure Codex using Environment variables and docker-compose.yaml file can be useful as an example.

We also added a temporary environment variable NAT_IP_AUTO to the entrypoint which is set as false for releases and true for regular builds. That approach is useful for Dist-Tests.

# Disable NAT_IP_AUTO for regular builds
docker run -e NAT_IP_AUTO=false codexstorage/nim-codex

Slim

  1. Build the image using docker build -t status-im/codexsetup:latest -f codex.Dockerfile ..
  2. The docker image can then be minified using slim. Install slim on your path and then run:
    slim # brings up interactive prompt
    >>> build --target status-im/codexsetup --http-probe-off true
    
  3. This should output an image with name status-im/codexsetup.slim
  4. We can then bring up the image using docker-compose up -d.