Skip to content

gearboxworks/docker-tinygo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gearbox

TinyGo Container Docker container service for Gearbox

This is the repository for the TinyGo Container Docker container implemented for Gearbox.

TinyGo is a project to bring the Go programming language to microcontrollers and modern web browsers by creating a new compiler based on LLVM.

Repository Info

GitHub commit: commit-date

GitHub release(latest): last-release-date last-release-date release-state

Supported versions and respective Dockerfiles

Service Website Gear Name GitHub Version Docker Version Docker Size Docker Tags
TinyGo Container tinygo tinygo Docker Version Docker Size (0.10.0, 0.10)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.11.0, 0.11)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.12.0, 0.12)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.13.1, 0.13)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.14.1, 0.14)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.15.0, 0.15)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.16.0, 0.16)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.17.0, 0.17, latest)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.5.0, 0.5)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.6.1, 0.6)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.7.1, 0.7)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.8.0, 0.8)
TinyGo Container tinygo tinygo Docker Version Docker Size (0.9.0, 0.9)

About this container.

A driving force behind Gearbox is to improve the user experience using software, and especially for software developers.

Our vision is to empower developers and other software users to quickly and easily use almost any version of a software service, command line tool or API without without first getting bogged down with installation and configuration.

In other words, our vision for Gearbox users is that software "just works".

Using this container.

This container has been designed to work within the Gearbox framework. However, due to the flexability of Gearbox, it can be used outside of this framework.

There are two methods:


Method 1: Using Gearbox launch

launch is a tool specifically designed to interact with a Gearbox Docker container.

It provides three important functional areas, without any Docker container learning curve:

  • Install, uninstall services and applications as though it was native. (Even multiple versions!)
  • Complete integration with Gearbox container commands with the host PC. (Environment and filesystem.)
  • Allows control over Gearbox containers: stop, start, create, remove.
  • Build, update, modify and release Gearbox images.
  • The Gearbox container doesn't even have to be local. (Great for team development.)

It also provides a functional SSH daemon for connecting remotely as well as a standard set of common tools and utilities.

Further launch documentation can be found here.

Installing launch

launch is currently in beta testing and is included along with all Gearbox Docker repos. Once out of beta, it will be included within the Gearbox installation package.

For now, simply download the standalone launch binary for your O/S.

This executable can be placed anywhere on your filesystem that is within your PATH environment variable. (This is usually /usr/local/bin)

It's suggested to copy this binary to it's own directory

mkdir -p /usr/local/gearbox/bin
cp ./launch /usr/local/gearbox/bin
chmod a+x /usr/local/gearbox/bin/launch

and add this to your PATH.

echo 'PATH="/usr/local/gearbox/bin:${PATH}"' >> ~/.profile

Running launch

There are many ways to call launch, either directly or indirectly. Additionally, all host environment variables will be imported into the container seamlessly. This allows a devloper to try multiple versions of software as though they were installed locally.

If a container is missing, it will be downloaded and created. Multiple versions can co-exist.

Install, create, and start the latest version of tinygo Gearbox container.

./bin/launch install tinygo

me@home:~ % ./bin/launch shell tinygo
Gearbox: Installing Gear 'tinygo:latest'.
Gearbox: Downloading Gear 'tinygo:latest'.
Gearbox: Pulling Gear tinygo:latest.
Gearbox: [==================================================>]  141.6MB/141.6MB
Gearbox: Pulling Gear tinygo:latest - OK.
Gearbox: Installed Gear 'tinygo:latest' OK.
me@home:~ 

Install, create, and start the latest version of tinygo Gearbox container. Run a shell.

./bin/launch shell tinygo

me@home:~ % ./bin/launch shell tinygo
Gearbox: Installing Gear 'tinygo:latest'.
Gearbox: Downloading Gear 'tinygo:latest'.
Gearbox: Pulling Gear tinygo:latest.
Gearbox: [==================================================>]  141.6MB/141.6MB
Gearbox: Pulling Gear tinygo:latest - OK.
Gearbox: Installed Gear 'tinygo:latest' OK.
Gearbox: Starting gear 'tinygo:latest':
Gearbox: Gear 'tinygo:latest' started OK
[tinygo:0.15.0] ~ $ 

Create, and start version 0.15.0 of the tinygo Gearbox container and run a shell with commands.

./bin/launch shell tinygo:0.15.0 ls -l

me@home:~ % ./bin/launch shell tinygo:0.15.0 ls -l
Gearbox: Gear 'tinygo:0.15.0' already started.
total 60
-rw-r--r--    1 gearbox  gearbox       5864 May 24 02:25 Makefile
-rw-r--r--    1 gearbox  gearbox      18757 May 24 02:25 README.md
drwxr-xr-x    1 gearbox  gearbox        374 May 24 02:25 TEMPLATE
drwxr-xr-x    1 gearbox  gearbox       1224 May  9 05:48 bin
drwxr-xr-x    1 gearbox  gearbox        238 May 22 01:33 build
-rw-r--r--    1 gearbox  gearbox       2196 May 22 01:35 files
-rw-r--r--    1 gearbox  gearbox       5313 May 24 01:34 gearbox.json
-rw-r--r--    1 gearbox  gearbox        596 May 22 01:27 packages
drwxr-xr-x    1 gearbox  gearbox        136 May 22 01:40 versions
me@home:~ % 

./bin/launch shell tinygo:0.15.0 ps -eaf

me@home:~ % ./bin/launch shell tinygo:0.15.0 ps -eaf
Gearbox: Gear 'tinygo:0.15.0' already started.
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/s6-svscan /etc/gearbox/services
   16 root      0:00 s6-supervise GearShift
   17 root      0:00 s6-supervise sshd
   18 root      0:00 s6-supervise tinygo
   19 root      0:00 {GearboxGearshif} /bin/bash /usr/local/sbin/GearboxGearshift
   20 root      0:00 /usr/sbin/sshd -D -e
 3342 root      0:00 sshd: gearbox [priv]
 3344 gearbox   0:00 sshd: gearbox@notty
 3345 gearbox   0:00 ps -eaf
me@home:~ % 

Provide information on the installed Gearbox container.

./bin/launch list tinygo

me@home:~ % ./bin/launch list tinygo
Downloaded Gearbox images: 1 found
+----------+----------------------------------+-------+--------+
| CLASS    | IMAGE                            | PORTS | SIZE   |
+----------+----------------------------------+-------+--------+
| graphics | gearboxworks/tinygo:0.15.0  |       |  40 MB |
+----------+----------------------------------+-------+--------+

Installed Gearbox gears: 1 found
+---------------------+----------+---------+----------------------------------+-------+----------+---------------+--------+--------+
| NAME                | CLASS    | STATE   | IMAGE                            | PORTS | SSH PORT | IP ADDRESS    | MOUNTS | SIZE   |
+---------------------+----------+---------+----------------------------------+-------+----------+---------------+--------+--------+
| tinygo-0.15.0  | graphics | created | gearboxworks/tinygo:0.15.0  |       |          | (gearboxnet)  |        |  40 MB |
|                     |          |         |                                  |       |          |               |        |        |
+---------------------+----------+---------+----------------------------------+-------+----------+---------------+--------+--------+


Configured Gearbox networks:
+------------+--------+---------------+
| NAME       | DRIVER | SUBNET        |
+------------+--------+---------------+
| gearboxnet | bridge | 172.42.0.0/24 |
+------------+--------+---------------+

Gearbox container command integration

When a Gearbox container is installed - specified commands, (as defined by the gearbox.json file), will be symlinked to the ./bin/launch executable.

This allows for seamless integration of a Gearbox container's commands with the host machine.

Gearbox containers may have many executables. Additionally if tinygo is also symlinked to ./bin/launch, it will run the default command defined with the the container. No need to specify that command as in the shell example above.

./tinygo

./tinygo -flag1 -flag2 variable1 variable2 variable3

./bin/launch run tinygo:0.15.0 -flag1 -flag2 variable1 variable2 variable3

./default -flag1 -flag2

Available commands

The tinygo Gearbox container has no defined commands within the gearbox.json file. The tinygo Gearbox container has the following 2 available commands:

Host Executable Name Gearbox Container Executable Name
(default command) /usr/local/tinygo/bin/tinygo
tinygo /usr/local/tinygo/bin/tinygo

Remote connection

ssh - All Gearbox containers have a running SSH daemon. So you can connect remotely. To show what ports are exported to the host, use the following command.

./bin/launch list tinygo

Method 2: Docker Hub

It is strongly suggested to use Gearbox launch as everything is done for you. However, you can still work with a Gearbox Gears as though it's a normal Docker container.

Setup from Docker Hub

A simple docker pull gearbox/tinygo will pull down the latest version.

Starting

start - Spin up a Docker container with the correct runtime configs.

docker run -d --name tinygo-latest --restart unless-stopped --network gearboxnet gearbox/tinygo:latest

Stopping

stop - Stop a Docker container.

docker stop tinygo-latest

Remove container

rm - Remove the Docker container.

docker container rm tinygo-latest

Run in foreground

run - Run a Docker container in the foreground, (all STDOUT and STDERR will go to console). The Container be removed on termination.

docker run --rm --name tinygo-latest --network gearboxnet gearbox/tinygo:latest

Run a shell

shell - Run a shell, (/bin/bash), within a Docker container.

docker run --rm --name tinygo-latest -i -t --network gearboxnet gearbox/tinygo:latest /bin/bash

SSH

ssh - All Gearbox containers have a running SSH daemon. So you can connect remotely.

Either use launch above or discover the port and SSH directly.

SSH_PORT="$(docker port tinygo-latest 22/tcp | sed 's/0.0.0.0://')"
ssh -p ${SSH_PORT} -o StrictHostKeyChecking=no gearbox@localhost

Building from this GitHub repo.

Setup from GitHub repo

Simply clone this repository to your local machine

git clone https://github.com/gearboxworks/docker-tinygo.git

Makefile targets

make build - Build Docker images. Build all versions from the base directory or specific versions from each directory.

make list - List already built Docker images. List all versions from the base directory or specific versions from each directory.

make clean - Remove already built Docker images. Remove all versions from the base directory or specific versions from each directory.

make push - Push already built Docker images to Docker Hub, (only for Gearbox admins). Push all versions from the base directory or specific versions from each directory.

Runtime from GitHub repo

You can either build your container as above, or use it from DockerHub with these commands:

make start - Spin up a Docker container with the correct runtime configs.

make stop - Stop a Docker container.

make run - Run a Docker container in the foreground, (all STDOUT and STDERR will go to console). The Container be removed on termination.

make shell - Run a shell, (/bin/bash), within a Docker container.

make rm - Remove the Docker container.

make test - Will issue a stop, rm, clean, build, create and start on a Docker container.


Note: This README was generated by launch - v1.8.1 - Created on 2021-05-05T21:52:52+1000, using template:README.md.tmpl and json:gearbox.json

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published