Skip to content
Snippets Groups Projects
Commit 2dc8bf09 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

feat(#157): Dockerfile update

parent 1798ac97
No related branches found
No related tags found
1 merge request!214Resolve "Ease the installation of distance Oracle"
......@@ -17,4 +17,17 @@ This feature is organized in multiple parts:
- **/distance-oracle/** (here): binary executing the distance algorithm
- **/primitives/distance/**: primitive types used both by client and runtime
- **/client/distance/**: exposes the `create_distance_inherent_data_provider` which provides data to the runtime
- **/pallets/distance/**: distance pallet exposing type, traits, storage/calls/hooks executing in the runtime
\ No newline at end of file
- **/pallets/distance/**: distance pallet exposing type, traits, storage/calls/hooks executing in the runtime
## Usage (with Docker)
Exemple for GDev:
> Supposes that you have a Docker host with a `/data/duniter-v2s` folder that is used as a mounted volume for a duniter-v2s validator node to `/var/lib/duniter`.
```bash
docker run --rm -it --entrypoint docker-distance-entrypoint \
-v /data/duniter-v2s/chains/gdev/distance/:/distance \
-e ORACLE_RPC_URL=wss://gdev.cgeek.fr:443 \
duniter/duniter-v2s-gdev:latest
```
\ No newline at end of file
......@@ -84,6 +84,11 @@ LABEL maintainer="Gilles Filippini <gilles.filippini@pini.fr>"
LABEL version="0.0.0"
LABEL description="Crypto-currency software (based on Substrate framework) to operate Ğ1 libre currency"
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates
RUN update-ca-certificates
RUN adduser --home /var/lib/duniter duniter
# Configuration
......@@ -96,3 +101,4 @@ USER duniter
# Intall
COPY --from=build /root/build /usr/local/bin/
COPY docker/docker-entrypoint /usr/local/bin/
COPY docker/docker-distance-entrypoint /usr/local/bin/
#!/bin/bash
# Custom startup if a first argument is present and is equal to '--'
# then we just run duniter with the provided arguments (but the '--')
# without applying all the automated configuration below
if [ "$1" = -- ]; then
shift
distance-oracle "$@"
fi
ORACLE_RESULT_DIR="${ORACLE_RESULT_DIR:-/distance}"
ORACLE_EXECUTION_INTERVAL="${ORACLE_EXECUTION_INTERVAL:-1800}"
ORACLE_MAX_DEPTH="${ORACLE_MAX_DEPTH:-5}"
ORACLE_RPC_URL="${ORACLE_RPC_URL:-ws://127.0.0.1:9944}"
ORACLE_LOG_LEVEL="${ORACLE_LOG_LEVEL:-info}"
while [ true ]; do
distance-oracle -d "$ORACLE_RESULT_DIR" -D "$ORACLE_MAX_DEPTH" -u "$ORACLE_RPC_URL" -l "$ORACLE_LOG_LEVEL"
echo "Waiting $ORACLE_EXECUTION_INTERVAL seconds before next execution..."
sleep $ORACLE_EXECUTION_INTERVAL
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment