This is the base image for my variadic go repo containers.
350
Latest Tag Dockerfile: GoDevBase:Latest
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
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:
For vim vim-go is configured and ready to be used. Various smaller features include:
GoHome is setup. And a couple of utils are also installed along the way:
Content type
Image
Digest
Size
401.3 MB
Last updated
over 10 years ago
docker pull skarlso/godevbase