Giter Site home page Giter Site logo

gantree-cli-docker's Introduction

Gantree-Cli-Docker

This docker container is designed to simplify the setup and usage of gantree-cli

For deeper understanding of the items and concepts referenced in this document please see the READMEs for gantree-cli and gantree-lib.

For information on setting up docker see docs.docker.com/install

Setup

Files

Various configuration files need to be passed to the docker container on running, this is accomplised by mounting a host directory as the /gantree directory in the container. The mounted directory should contain a structure that will be recognized by the container and is described below.

To mount a directory when running the container:

docker run -v /home/myuser/work/gantree-working:/gantree gantree-cli-docker

Files you may wish to add to this directory:

  • {host-dir}/config/{your-gantree-configuration-file}.json
  • {host-dir}/gcp/{your-google-application-credentials}.json
  • {host-dir}/ssh/{your-ssh-private-key}

Private keys should be RSA type, contain embedded PEM information, and not use a password
Some versions of ssh-keygen will generate this key by default, for others versions you can force this behaviour:

ssh-keygen -f ./ssh_id_rsa_validator -t rsa -m PEM -q -N ""

For more information about these files see the gantree-cli documentation.

Environment Variables

Some credentials can be passed directly to the docker container as environment variables.

These include:

  • GANTREE_CONFIG_PATH
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • DO_API_TOKEN
  • GCP_AUTH_KIND
  • GCP_SERVICE_ACCOUNT_FILE

To pass environment variables when running the container:

docker run -e DO_API_TOKEN=XXXXXXXXX gantree-cli-docker

or

docker run --env-file myenvfile gantree-cli-docker

where myenvfile contains

DO_API_TOKEN=XXXXXXXXX

HOST_USER

The HOST_USER environment variable can also be passed to ensure files created by docker in the {host-folder} become owned by the host machine's user account

As a run command parameter:

-e HOST_USER=$(id -u)

Or in the env-file if you set HOST_USER to the result of running id -u in terminal, eg. 1000, 1001, .. depending on your system

Paths

Environment variables that contain paths should point to the file location mounted inside the container

For example, if a config file is located on the host at

/home/myuser/my_gantree_workspace/config/myconfig.json

the container could be run with

docker run \
    -v /home/myuser/my_gantree_workspace:/gantree \
    -e GANTREE_CONFIG_PATH=/gantree/config/myconfig.json \
    -e HOST_USER=$(id -u) \
    --rm -ti
    gantree-cli-docker

Gantree config files support user defined environment variable lookup of the form

{
    "some_key": "$env:USER_DEFINED_ENV_VAR"
}

These can also be passed through using the above methods

Usage

Build the container

docker build -t {docker-image-name} .

eg.

docker build -t gantree-cli-docker .

Run gantree-cli-docker

docker run -v {host-directory}:/gantree \
           --env-file {env-file} \
           -e HOST_USER=$(id -u) \
           --rm -ti \
           {docker-image-name} [cli arguments]

eg.

docker run -v /home/myuser/work/gantree_work:/gantree \
           --env-file /home/myuser/work/gantree_env/envfile \
           -e HOST_USER=$(id -u) \
           --rm -ti \
           gantree-cli-docker sync

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.