Public Repository

Last pushed: a year ago
Short Description
This is the base image for my variadic go repo containers.
Full Description

Dockerfile

Latest Tag Dockerfile: GoDevBase:Latest

Description

This repository can be used to work on individual Go projects. Each container can be used to work on one repo. With the dawn of Docker containers working seamlessly on Mac, and Windows, it's easy to put together an isolated environment which is secure, fast and clean. The key to this is isolation. While you can work on the repo from a shared directory, the supporting libraries and infrastructure does not have to pollute your Operating System.

To do this, create the following Dockerfile:

# This is a container for developing the famous Static Website generator framework
# Hugo.
FROM skarlso/godevbase
MAINTAINER Gergely Brautigam

USER default

# First, install and setup Glide for later use.
RUN mkdir -p /home/default/gohome/src/github.com/Masterminds/glide
RUN git clone https://github.com/Masterminds/glide.git /home/default/gohome/src/github.com/Masterminds/glide
WORKDIR /home/default/gohome/src/github.com/Masterminds/glide
USER root
RUN make build && make install

USER default
# Second, setup the repo to work with.
ARG repo=hugo
ARG user=Skarlso
RUN mkdir -p /home/default/gohome/src/github.com/$user/$repo
RUN git clone https://github.com/$user/$repo.git /home/default/gohome/src/github.com/$user/$repo/
WORKDIR /home/default/gohome/src/github.com/$user/$repo

# I'm using Glide to manage dependencies to that repo which makes it pretty easy
# and trivial to develop. Run a glide init. Then glide install.
RUN glide init --non-interactive && glide install

Building the Container

Note, that I'm using Glide. It is a very attractive way of managing your third-party libraries in a vendor folder. go build and all other tools, just work out of the box.

Once this file is there, you can use the following command to construct a dev container:

docker build -t hugodev:latest --build-arg user=Skarlso --build-arg repo=hugo .

This will create an Image which than you can use to work on Hugo, from the User's github repository.

To run the container and link the 'src' directory from go to an outer directory, run the following command:

docker run -it --name hugocon -p 9191:9191 hugodev:latest /bin/bash --login

Use --login to load the .bash_profile which sets up prompt and one alias.

After this, you are ready to work on whatever library you would like to work on without polluting your own environment. The -p 9191 is so that you can debug running websites from your own laptop's browser.

What's inside the base box? If you don't want to read the Dockerfile, here is a quick list:

Vim

For vim vim-go is configured and ready to be used. Various smaller features include:

  • NerdTree (for folder view.) It is always toggled to be on. To disable this set this ~/.vimrc: let g:nerdtree_tabs_open_on_console_startup=0
  • Colorscheme onedark
  • 4 spaces for tabs
  • PowerShell Syntax Highlight
  • Autocomplete of various things with YouCompleteMe
  • Ctags
  • Plain Tasks for simple todos like in SublimeText
  • SVN and Git integration
  • Syntax Highlight
  • Numbered Lines
  • Highlight search results
  • A few key bindings
    • F8 :TagbarToggle
    • F10 :UpdateTags
    • C-n :NERDTreeToggle
    • F7 :tabnew

Environment

GoHome is setup. And a couple of utils are also installed along the way:

  • htop
  • vim
  • git
  • wget
  • mc
  • nmap
  • lynx
  • build-essential cmake
  • python-dev
  • ctags
Docker Pull Command
Owner
skarlso

Comments (0)