CLI to run a docker image with R. CLI built using cobra library in go.

BlueBeak Installation Guide

Task 1: Building the CLI

The directory structure looks like

Untitled

Fastest process:

1)cd into bbtools

2)cd into bbtools/bin

3)I have executables for linux arm64, windows amd64 and mac (darwin amd64),If you have any other system then skip this section and go to the next section.

Assuming you are on linux execute the command

./bbtools

Untitled

Run install command:

./bbtools install

Run greet command:

./bbtools greet hello ron

Untitled

Building CLI binary using Go:

Installing GO:

This requires us to install go. There are a couple of ways to install go.

  1. Downloading go installer from their official site:

Download and install

  1. Using make file to install go:

I have also created a Makefile that installs and add the go to path for linux.

make

This installs go and then runs go install to create the binary which is located in ~/go/bin.

Now we can be in any directory and use bbtools. (like run ~/go/bin/bbtools greet hello ron)

  1. In ubuntu we can use snap to install go.
sudo apt update
sudo apt install snapd
sudo snap install go --classic

Check go installation using:

go version

Building the binary:

Now that go is installed we can build the executable. (No need to do this if installed using make as make already has built the binary executable)

cd bbtools
go install
bbtools install
bbtools greet hello ron

We can run bbtools from any directory once go install has been run. We don’t necessarily need to be inside bbtools directory.

NOTE: If go aur bbtools are not running due to command not found error there are two ways to resolve this.

cd bbtools
usr/local/go/bin/go install
~/go/bin/bbtools install
~/go/bin/bbtools bbtools greet hello ron

OR add path to ~/.profile like (gedit ~/.profile)

export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:/home/zeedx/go/bin

then run source and the go and bbtools should work without having to give their paths.

source ~/.profile
go version

Task 2: Building nanovm using ops to run a R script

Install ops:

Refer to

Getting Started

curl https://ops.city/get.sh -sSfL | sh
sudo apt-get install qemu-kvm qemu-utils

Running hello.R script:

cd bbtools
ops pkg load R_3.4.4 -c config.json

Untitled

Thus we get the desired output

Side note:

I was ideally supposed to pull the docker image from local registry and then run the hello.R using that but despite trying several different base images that didn’t happen. I also spoke to the main collaborator and creater and CEO of nanovms and he said that there is an issue with Rscript specifically that deters the run of a R script using the Rscript command. I am attaching everything I did in the page below.

ops from docker

view the readme in notion

Owner
Aniruddha Chattopadhyay
I am an automation enthusiast. I am an avid reader. Curiosity always gets the best of me. Always up for discussing extravagantly ambitious ideas.
Aniruddha Chattopadhyay
Similar Resources

This project is used to get familiar with GoLang cli apps, along with cobra generator.

SecretCTL SecretCTL About the project Status Getting started Layout Notes About the project This project is used to get familiar with GoLang cli apps,

Jan 11, 2022

Cobra CLI tool to generate applications and commands

Cobra Generator Cobra provides its own program that will create your application and add any commands you want. It's the easiest way to incorporate Co

Jan 3, 2023

Count once - Just once? no, when appear many it run once, but it can run many times

countOnce just once? no, when appear many it run once, but it can run many times

Jan 29, 2022

A tool for exploring each layer in a docker image

A tool for exploring each layer in a docker image

dive A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image. To analyze a Docker image

Jan 9, 2023

command argument completion generator for spf13/cobra

Command argument completion generator for cobra. You can read more about it here: A pragmatic approach to shell completion.

Dec 26, 2022

A command line tool for simplified docker volume command built with go

dockervol A command line tool for simplified docker volume command built with go. Features: Remove anonymous volume (beta) Remove volume by matching n

Dec 18, 2021

Godzillacli - Create, Run Godzilla Projects Using Godzilla CLI

godzillacli Create, Run Godzilla Projects Using Godzilla CLI About: godzillacli

Jan 23, 2022

A wrapper of aliyun-cli subcommand alidns, run aliyun-cli in Declarative mode.

aliyun-dns A wrapper of aliyun-cli subcommand alidns, run aliyun-cli in Declarative mode. Installation Install aliyun-cli. Usage $ aliyun-dns -h A wra

Dec 21, 2021

❓🖼 Find the anime scene by image using your terminal

❓🖼 Find the anime scene by image using your terminal

What Anime CLI ❓ 🖼 This application is basically a 🍬 wrapper around trace.moe PREVIEW Usage 🖥 Get Anime By Image File 🗃 what-anime file anime.jp

Jan 2, 2023
Related tags
Simple CLI using spf13/cobra and Flink REST API

Flinkctl Flinkctl is a simple CLI written on Go using Cobra created to facilitate my team's daily basis work with multiple Flink clusters at Azion Tec

Aug 16, 2022
Reusable golang-migrate library using cobra utility

shift Reusable golang-migrate library using cobra utility Example Usage package main import ( "sql/db" "github.com/purwandi/shift" "github.com

Dec 16, 2021
The blackbean is a command tool for elasticsearch operations by using cobra.
The blackbean is a command tool for elasticsearch operations by using cobra.

The blackbean is a command tool for elasticsearch operations by using cobra. Besides, blackbean is the name of my lovely French bulldog.

Mar 3, 2022
It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`

It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`. It's a makefile alternative and a shell wrapper.

Oct 18, 2022
Build an interactive CLI application with Go, Cobra and promptui. Video tutorial available on the Div Rhino YouTube channel.

Build an interactive CLI app with Go, Cobra and promptui Text tutorial: https://divrhino.com/articles/build-interactive-cli-app-with-go-cobra-promptui

Dec 8, 2022
Prompts users to enter values for required flags in Cobra CLI applications

Cobra Flag Prompt Cobra Flag Prompt prompts users to enter values for required flags. It is an extension of Cobra, and requires that you use Cobra to

Nov 13, 2021
Generate an interactive, autocompleting shell for any Cobra CLI
Generate an interactive, autocompleting shell for any Cobra CLI

cobra-shell Description Leverages the Cobra completion API to generate an interactive shell for any Cobra CLI, powered by go-prompt. On-the-fly autoco

Dec 19, 2022
A cli client-server app with cobra
A cli client-server app with cobra

cli-client-server-calculator a cli client-server app with cobra overview this project is a cli client-server app in which client gives a bunch of numb

Dec 7, 2021
Cobra CLI challenge Segsalerty

Banking app done using Cobra CLI - Segsalerty challenge c/o Segun Mustafa It uses a database.json file as datastore for queries - createCustomer, Upda

Dec 14, 2021