Skip to content

Commit 7570681

Browse files
author
Edward Muller
committed
Make small docker images based on Alpine
For that we need a Dockerfile and a cross compiled executable. Package creation of the executable up into a Makefile. This requires go1.5+ for each cross compilation.
1 parent 80d6840 commit 7570681

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.env
2+
.docker_build/

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM alpine:latest
2+
3+
MAINTAINER Edward Muller <edward@heroku.com>
4+
5+
WORKDIR "/opt"
6+
7+
ADD .docker_build/go-getting-started /opt/bin/go-getting-started
8+
ADD ./templates /opt/templates
9+
ADD ./static /opt/static
10+
11+
CMD ["/opt/bin/go-getting-started"]
12+

Godeps/Godeps.json

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
GO_BUILD_ENV := GOOS=linux GOARCH=amd64
2+
DOCKER_BUILD=$(shell pwd)/.docker_build
3+
DOCKER_CMD=$(DOCKER_BUILD)/go-getting-started
4+
5+
$(DOCKER_CMD): clean
6+
mkdir -p $(DOCKER_BUILD)
7+
$(GO_BUILD_ENV) go build -v -o $(DOCKER_CMD) .
8+
9+
clean:
10+
rm -rf $(DOCKER_BUILD)
11+
12+
heroku: $(DOCKER_CMD)
13+
heroku container:push web
File renamed without changes.

0 commit comments

Comments
 (0)