Skip to content
No description, website, or topics provided.
Go Makefile Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/my_go_project
.gitignore
Dockerfile
Makefile
README.md
docker-compose.yml

README.md

Go Docker Environment

http://surenderthakran.com

Salient Features:

  • Runs on Go 1.7.3
  • Docker images based on Ubuntu 16.04
  • Architecture and dependencies are encapsulated in docker images hence making the dev and production environment COMPLETELY independent of host machine.
  • Package dependencies are auto installed on image creation.
  • In Development Environment:
    • Provides simple development environment setup with docker-compose.
    • Provides save detection and auto restart using reflex.

How To Use:

To build docker image for the go application:

docker build --no-cache=true -t go_app .

To run docker container:

docker run -it -d --name go_app_1 --net=host go_app

With --net=host the container will listen for requests on port 18770.

To listen on a different port (ex: 80) run:

docker run -it -d --name go_app_1 -p 80:18770 go_app

To set up development environment:

docker-compose build
docker-compose up

Above commands will run the blogger docker container with the src/my_go_project folder volume mounted. These will also start reflex watcher to restart service on save in any Go files under src/my_go_project. Restarting the service involves:

  • Running gofmt on all files under src/my_go_project
  • Installing service
  • Running test cases
  • Running service

Note: When a new dependency is added, it is imperative to run docker-compose build again

You can’t perform that action at this time.