Last active
April 1, 2016 19:42
-
-
Save jessfraz/fabbda1eeff44d5d97aced2fb65a928d to your computer and use it in GitHub Desktop.
simple hello world
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Makefile | |
.git | |
.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM scratch | |
COPY hello /hello | |
CMD ["/hello"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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