Container images for portable development environments

Overview

Docker Dev

Spin up a container to develop from anywhere!

docker-dev

To run, just:

docker run -ti aghost7/nodejs-dev:boron tmux new

Alternatively, if on Linux:

python3 -m pip install --user slipway
slipway start aghost7/nodejs-dev:carbon

Terminal

Lately, I've been using alacritty. You can find my configurations here. Gnome terminal and/or iTerm2 works fine though.

Images

Language Images

  • ubuntu-dev-base: Ubuntu image with a few presets such as docker of already installed. It is also configured to allow passwordless sudo just like those vagrant images. Tags available:
    • focal: Ubuntu Focal Fossa (20.04) image.
  • power-tmux: Powerline + Tmux. Based from the ubuntu-dev-base image. Images available:
    • focal
  • nvim: NeoVim image. Based from ubuntu-tmux. Language agnostic vim setup (no language-specific plugins in there). Images available:
    • focal
  • nodejs-dev: nvm + nodejs specific configurations. Tags available:
    • focal-erbium: Ubuntu 20.04 + NodeJs 12.
    • focal-fermium: Ubuntu 20.04 + NodeJs 14.
  • rust-dev: NeoVim configuration and autocomplete for the Rust language.
    • focal-stable uses rust stable with YouCompleteMe backed by only racer.
    • focal-nightly uses rust nightly with deoplete backed by RLS.
  • py-dev: Python configuration with autocomplete for python and ptpython.
    • focal: Ubuntu 20.04 + python 3.8
  • ruby-dev: Ruby image with language server. Tags:
    • focal: Ruby 2.3 pre-installed.
  • c-dev: Ubuntu Bionic image for c development with cquery for completions.
    • focal: Ubuntu 20.04 + clangd
  • deno-dev: Ubuntu Bionic image for deno development with bash completions. Tags Available:
    • bionic: Ubuntu 18.4 + Deno v1.0
  • devops: Python image with additional tools (e.g., terraform) for devops related tasks. Images available:
    • focal

Database Images

  • pg-dev: Postgresql image with pgcli, a command line client with autocompletions and syntax highlighting. Tags correspond to the Postgresql version:
    • 9.6
    • 10
    • 11
  • my-dev: MySql image with mycli utility. Tags correspond to the mysql version:
    • 5.6
    • 5.7
    • 8.0
  • mongo-dev: Official mongodb image with Mongo Hacker added. Tags correspond to the mongdb version:
    • 4.1
  • redis-dev: Redis image with iredis included. Tags available:
    • 6

Vim Configuration

Vim configurations are broken down into three parts:

  • init.vim: This is the equivalent for .vimrc in NeoVim.
  • plugin.vim: This contains all plugins which will be installed using vim.plug.
  • post-plugin.vim: Contains all plugin-specific configurations for Neovim. Configurations which aren't plugin-specific reside in the init.vim file.

Breaking it down this way allows one to just run cat addition.vim >> $XDG_CONFIG_PATH/file to add new plugins and configs for specific programing languages and libraries.

Calling Docker on the Host

The docker daemon run over a socket. The command line tool is just a client to the daemon. In other words, if we make the socket connectable from within the container we're in business.

For some reason it needs privileged to work as well.

docker run -ti --rm \
	--privileged \
	-v `readlink -f /var/run/docker.sock`:/var/run/docker.sock \
	aghost7/ubuntu-dev-base:latest \
	tmux new

SSH Forwarding and Git

For ssh, just pass the socket over to the container.

docker run -ti --rm \
	-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK \
	-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
	aghost7/ubuntu-dev-base:latest \
	tmux new

I like to avoid having to reconfigure git every time, so I mount a volume for .gitconfig. ~/.ssh/known_hosts is also anoying.

Getting the Clipboard Working

Basically, X11 is built in a manner that allows sending display data over the wire. I've managed to run GUI applications from a headless server through an ssh connection in the past. The way I'm doing this is through the same old unix socket trick for controlling the docker daemon that's on the host machine.

docker run -ti --rm \
	-e DISPLAY=$DISPLAY \
	-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
	aghost7/ubuntu-dev-base:latest bash

On the host you'll need to disable one of the security features in X11.

xhost +si:localuser:$USER > /dev/null

Source: http://stackoverflow.com/questions/25281992/alternatives-to-ssh-x11-forwarding-for-docker-containers

Build your own

There is a tutorial which can be found here.

Comments
  • Cargo issues in rust-dev

    Cargo issues in rust-dev

    Looks like cargo isn't added to the path and the registry has the wrong permissions in the rust container. Probably just need to move this line to the end of the build script and update path? https://github.com/AGhost-7/docker-dev/blob/master/images/rust-dev/base/rust-install.sh#L7

    ❯ docker run --rm -v ~/Code/ring:/home/aghost-7/ring -v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -it aghost7/rust-dev:focal-stable /bin/bash
    $ cd ring/
    $ cargo build
    bash: cargo: command not found
    $ ~/.cargo/bin/c
    cargo          cargo-clippy   cargo-fmt      cargo-miri     cargo-watch    clippy-driver
    $ ~/.cargo/bin/cargo build
    error: failed to get `untrusted` as a dependency of package `ring v0.16.15 (/home/aghost-7/ring)`
    
    Caused by:
      failed to create directory `/home/aghost-7/.cargo/registry/index/github.com-1ecc6299db9ec823`
    
    Caused by:
      Permission denied (os error 13)
    $ ls -la ~/.cargo
    total 36
    drwxr-xr-x 1 aghost-7 aghost-7 4096 Oct 23 15:54 .
    drwxr-xr-x 1 aghost-7 aghost-7 4096 Oct 24 21:29 ..
    drwxr-xr-x 2 aghost-7 aghost-7 4096 Oct 23 16:05 bin
    -rw-r--r-- 1 aghost-7 aghost-7  465 Oct 23 16:05 .crates2.json
    -rw-r--r-- 1 aghost-7 aghost-7   99 Oct 23 16:05 .crates.toml
    -rw-r--r-- 1 aghost-7 aghost-7   37 Oct 23 15:53 env
    -rw-r--r-- 1 aghost-7 aghost-7    0 Oct 23 15:53 .package-cache
    drwxr-xr-x 2 root     root     4096 Oct 23 15:51 registry
    
    opened by aig787 8
  • Document building your own

    Document building your own

    • [x] Document benefits of containerizing environment.
    • [x] Minimal tmux setup (no powerline).
    • [ ] Clipboard
    • [x] From ubuntu:xenial, how to install basic tooling (git, ssh, curl, man, etc).
    • [x] Minimal, language agnostic vim setup.
    • [x] Specialize for a particular stack (nodejs web development).
    • [ ] docker and compose
    opened by AGhost-7 5
  • Create docker ssh mountpoint and set permissions

    Create docker ssh mountpoint and set permissions

    The old ssh forwarding method of mounting the sock no longer works in MacOS. This change just creates the mountpoint and sets the permissions appropriately so that /run/host-services/ssh-auth.sock can be accessed by the aghost-7 user. The conversation from the docker team can be found here https://github.com/docker/for-mac/issues/410.

    opened by aig787 3
  • question about build.sh

    question about build.sh

    I am trying to understand something with your build.sh. It has a number of 'apt-install' commands.

    Is there a reason they are done in the script vs. the Dockerfile? If there were done in the Dockerfile, it seems like you could then better leverage docker layering. Just wondering.

    question 
    opened by AGeekInside 1
  • Section 5 readme update

    Section 5 readme update

    • fixed typo
    • added new header after optional section (to make it more apparent what is optional)
    • added latest node install via dockerfile comment

    that is all

    opened by hardy613 1
  • Ruby image

    Ruby image

    There are two language server implementations:

    • https://github.com/mtsmfm/language_server-ruby
    • https://github.com/castwide/solargraph

    Neither seem to work properly... will need to take a second look at getting the first one running as a container. Seems to be how the vscode plugin currently works.


    plugin.vim:

    Plug 'autozimu/LanguageClient-neovim', {
        \ 'branch': 'next',
        \ 'do': 'bash install.sh',
        \ }
    

    post-plugin.vim:

    nnoremap <F5> :call LanguageClient_contextMenu()<CR>
    nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
    nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
    nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
    
    let workspaceVolume = '/home/jonathan/workspaces/foobar:/home/aghost-7/workspaces/foobar'
    
    let g:LanguageClient_serverCommands = {
      \ 'ruby': ['docker', 'run', '-i', '--rm', '-v', workspaceVolume, 'mtsmfm/language_server-ruby:latest']
      \ }
    
    

    Still need to find a good way to re-map the volume automatically, getcwd() from vim isnt going to be enough.


    Also will require storing my environment stuff under ~/.rvm/rubies on the host...


    todo list:

    • [x] semantic completion / goto definition / fetch doc
    • [x] improved repl: http://pryrepl.org/
    • [x] debugger?
    opened by AGhost-7 1
  • Refactor clipboard code

    Refactor clipboard code

    I want to be able to use my clipboard from any environment (either VM or native linux host). First step would be to add lemonade for a remote clipboard utility, then I could write a script like the following:

    if [ -z "$DISPLAY" ]; then
      cat - | lemonade copy
    else
      cat - | /usr/bin/xclip -selection clipboard
    fi
    

    My only concern is that I will then have two xclip executables on my path...

    Would need to update the tmux configuration as well I think.

    opened by AGhost-7 1
  • Don't bail if a leaf image fails to build

    Don't bail if a leaf image fails to build

    If an image without any dependents fails to build, it shouldn't prevent other images from building. build.py should still display the error and exit with a status code above 0 though.

    opened by AGhost-7 0
  • load virtualenv automatically for ycm

    load virtualenv automatically for ycm

    Right now, its not able to grab completions for libraries not part of the standard library. This will need to detect:

    • if poetry is being used, load from that environment
    • if there is an env directory in the root of the project, with a bin/python executable, use that virtual environment.
    opened by AGhost-7 0
  • System pre-commit hooks

    System pre-commit hooks

    Before committing, it should run static checks automatically if present in the project.

    python

    • black
    • mypy

    node

    • eslint
    • prettier (pretty-quick)

    rust

    • rustfmt
    • clippy
    opened by AGhost-7 0
  • Add editorconfig to base neovim image

    Add editorconfig to base neovim image

    Will need to check if this works with all languages correctly though.

    language defaults:

    • yaml (2 spaces)
    • python (4 spaces)
    • javascript (2 spaces)
    • typescript (2 spaces)
    • rust (4 spaces)
    • c (tabs)
    • ruby (2 spaces)
    • java (4 spaces)
    • sh (tabs)
    • everything else (4 spaces?)
    opened by AGhost-7 0
  • debugger integration

    debugger integration

    Could be handy to have python debugger integration. Looks like the project has matured significantly, hopefully things work: https://github.com/puremourning/vimspector

    opened by AGhost-7 0
  • Vader tests

    Vader tests

    Should add vader tests to ensure the autocompletion and such is always working.

    This will require some major changes to the testing stuff. Every image should have a test directory which only executes if the image gets built:

    • test/vader contains the vader tests
    • test/sh contains some shell scripts to test docker run commands.
    opened by AGhost-7 0
Owner
Jonathan Boudreau
Jonathan Boudreau
💻VIEN is a command-line tool for managing Python Virtual Environments.

vien VIEN is a command-line tool for managing Python Virtual Environments. It provides one-line shortcuts for: creating and deleting environments runn

Artёm IG 5 Mar 19, 2022
Lsp Plugin for working with Python virtual environments

py_lsp.nvim What is py_lsp? py_lsp.nvim is a neovim plugin that helps with using the lsp feature for python development. It tackles the problem about

Patrick Haller 55 Dec 27, 2022
A CLI tool for creating disposable environments.

dispenv - Disposable Python Environments ⚠️ WIP Need to make an environment to work on a GitHub issue? Want to try out a new package and not leave the

Peter Baumgartner 3 Mar 14, 2022
Zero-config CLI for TypeScript package development

Despite all the recent hype, setting up a new TypeScript (x React) library can be tough. Between Rollup, Jest, tsconfig, Yarn resolutions, ESLint, and

Jared Palmer 10.5k Jan 8, 2023
A Python package for Misty II development

Misty2py Misty2py is a Python 3 package for Misty II development using Misty's REST API. Read the full documentation here! Installation Poetry To inst

Chris Scarred 1 Mar 7, 2022
Textual: a TUI (Text User Interface) framework for Python inspired by modern web development

Textual Textual is a TUI (Text User Interface) framework for Python inspired by

null 17.1k Jan 4, 2023
Display Images in your terminal with python

A python library to display images in the terminal

Pranav Baburaj 57 Dec 30, 2022
Rover is a command line interface application that allows through browse through mission data, images, metadata from the NASA Official Website

?? rover Rover is a command line interface application that allows through browse through mission data, images, metadata from the NASA Official Websit

Saketha Ramanjam 4 Jan 19, 2022
img-proof (IPA) provides a command line utility to test images in the Public Cloud

overview img-proof (IPA) provides a command line utility to test images in the Public Cloud (AWS, Azure, GCE, etc.). With img-proof you can now test c

null 13 Jan 7, 2022
Display Images in your terminal with python

Term-Img Display Images in your terminal with python NOTE: This project is a work in progress and not everything on here has actually been implemented

My avatar ;D 118 Jan 5, 2023
Python CLI vm manager for remote access of docker images via noVNC

vmman is a tool to quickly boot and view docker-based VMs running on a linux server through noVNC without ssh tunneling on another network.

UCSD Engineers for Exploration 1 Nov 29, 2021
A CLI tool for using GLIDE to generate images from text.

Text-Glided-Diffusion Installation First clone this repository: git clone https://github.com/afiaka87/text-glided-diffusion.git cd text-glided-diffusi

Clay Mullis 68 Dec 30, 2022
A command line tool to hide and reveal information inside images (works for both PNGs and JPGs)

Imgrerite A command line tool to hide and reveal information inside images (works for both PNGs and JPGs) Dependencies Python 3 Git Most of the Linux

Jigyasu 10 Jul 27, 2022
Imgrerite - A command-line tool to hide and reveal information inside images

ImgReRite A command line tool to hide and reveal information inside images (work

Jigyasu 7 Feb 17, 2022
This project contains the ClonedPerson dataset and code described in our paper "Cloning Outfits from Real-World Images to 3D Characters for Generalizable Person Re-Identification".

ClonedPerson This is the official repository for the ClonedPerson project, which contains the ClonedPerson dataset and code described in our paper "Cl

Yanan Wang 55 Dec 27, 2022
VSCode Development Container Template

VSCode Development Container Template This template enables you to use a full-fledged containerized development environment for your machine learning

Paige Bailey 10 Oct 10, 2022
Hw-ci - Hardware CD/CI and Development Container

Hardware CI & Dev Containter These containers were created for my personal hardware development projects and courses duing my undergraduate degree. Pl

Matthew Dwyer 6 Dec 25, 2022
Bitcoin & Lightning Container Manager for facilitating development tools

Torch-cli Bitcoin & Lightning Container Manager for facilitating development too

Gray Finance 3 Aug 22, 2022
An image base contains 490 images for learning (400 cars and 90 boats), and another 21 images for testingAn image base contains 490 images for learning (400 cars and 90 boats), and another 21 images for testing

SVM Données Une base d’images contient 490 images pour l’apprentissage (400 voitures et 90 bateaux), et encore 21 images pour fait des tests. Prétrait

Achraf Rahouti 3 Nov 30, 2021