From 8b1273c426668ae4436f8dacf4a623c0edbd4384 Mon Sep 17 00:00:00 2001
From: Will McCutchen <will@mccutch.org>
Date: Sun, 25 Jun 2017 12:22:09 -0700
Subject: [PATCH] Add Dockerfile and image build process

---
 Dockerfile |  4 ++++
 Makefile   |  9 ++++++++-
 README.md  | 12 ++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 Dockerfile

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..7fee17d
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,4 @@
+FROM gcr.io/distroless/base
+COPY go-httpbin /bin/go-httpbin
+EXPOSE 8080
+CMD ["/bin/go-httpbin"]
diff --git a/Makefile b/Makefile
index 43e8449..f6fa9d4 100644
--- a/Makefile
+++ b/Makefile
@@ -24,4 +24,11 @@ clean:
 deps:
 	go get -u github.com/jteeuwen/go-bindata/...
 
-.PHONY: all
+image: assets cmd/go-httpbin/*.go httpbin/*.go
+	mkdir -p /tmp/go-httpbin-docker
+	cp Dockerfile /tmp/go-httpbin-docker
+	GOOS=linux GOARCH=amd64 go build -o /tmp/go-httpbin-docker/go-httpbin ./cmd/go-httpbin
+	docker build -t mccutchen/go-httpbin /tmp/go-httpbin-docker
+
+imagepush: image
+	docker push mccutchen/go-httpbin
diff --git a/README.md b/README.md
index 5a2fb19..23c90ac 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,12 @@ Usage of ./dist/go-httpbin:
         Port to listen on (default 8080)
 ```
 
+Docker images are also available on [Docker Hub][docker-hub]:
+
+```
+$ docker run -P mccutchen/go-httpbin
+```
+
 ## Installation
 
 ```
@@ -38,13 +44,19 @@ go get github.com/mccutchen/go-httpbin/...
 ## Development
 
 ```
+# local development
 make
 make test
 make testcover
 make run
+
+# building & pushing docker images
+make image
+make imagepush
 ```
 
 [kr]: https://github.com/kennethreitz
 [httpbin-org]: https://httpbin.org/
 [httpbin-repo]: https://github.com/kennethreitz/httpbin
 [ahmet-go-httpbin]: https://github.com/ahmetb/go-httpbin
+[docker-hub]: https://hub.docker.com/r/mccutchen/go-httpbin/
-- 
GitLab