Skip to content

🐳 This repo contains go docker images tailored for development purposes (lint, goveralls, etc).

License

Notifications You must be signed in to change notification settings

cn007b/docker-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go for DEVELOPMENT.

Docker Build Status Docker Automated build Docker Pulls

This image contains pre-installed tools helpful for development purposes.
Also this image can be used as part of build process (lint, test, cover, etc.)

List of installed tools:

  • dep
  • golint
  • gometalinter (< v1.12)
  • golangci-lint
  • cover
  • goveralls
  • dlv
  • gin
  • gosec
  • pprof
  • google-app-enginee (v1.10)

Usage:

CLI:

Create test package with purpose to check this docker image:

package main

func main() {
    println("It works!")
}

Now you can run next command:

docker run -it --rm -v $PWD:/app -w /app cn007b/go go run main.go

And you can run next command to check that everything is ok:

docker run -it --rm -v $PWD:/app -w /app cn007b/go sh -c '
  go vet
  go fmt ./...
  golint ./...
  golangci-lint run
  gosec -tests ./...
'

Web

package main

import (
	"net/http"
)

func main() {
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("Hello world!"))
	})
	http.ListenAndServe(":8080", nil)
}

Now you can run next command:

docker run -it --rm -p 80:80 -v $PWD:/app -w /app cn007b/go sh -c \
  'gin --port 80 --appPort 8080 run main.go'

# and
curl localhost:80

Google App Enginee (go 1.10):

With purpose to use google-app-enginee please use next commands:

docker run -it --rm cn007b/go:1.10-gae gcloud version
docker run -it --rm cn007b/go:1.10-gae goapp version