Skip to content

Instantly share code, notes, and snippets.

@jessfraz

jessfraz/.dockerignore

Last active Apr 1, 2016
Embed
What would you like to do?
simple hello world
Makefile
.git
.gitignore
###Go###
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
*.swo
*.swp
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
###OSX###
.DS_Store
.AppleDouble
.LSOverride
# Icon must ends with two \r.
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
hello
FROM scratch
COPY hello /hello
CMD ["/hello"]
package main
import (
"fmt"
"log"
"net/http"
"os"
)
const defaultPort = "8080"
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello DCOS!")
}
func main() {
port := os.Getenv("PORT0")
if port == "" {
port = defaultPort
}
http.HandleFunc("/", handler)
log.Println("Starting server on port: ", port)
http.ListenAndServe(":"+port, nil)
}
all: hello
hello:
CGO_ENABLED=0 go build -tags "$(BUILDTAGS) static_build" -ldflags "-w -extldflags -static" -o hello .
docker: hello
docker build --rm --force-rm -t jess/hello .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment