diff --git a/Dockerfile b/Dockerfile index b75fd4a5f859a6b083a74c8a678b704b513221e6..b27e98dc1d029b5c50f84827d3b069beff0b233d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,9 @@ COPY Makefile . RUN make deps COPY . . -RUN make +RUN make build buildtests FROM gcr.io/distroless/base -COPY --from=0 /go/src/github.com/mccutchen/go-httpbin/dist/go-httpbin /bin/go-httpbin +COPY --from=0 /go/src/github.com/mccutchen/go-httpbin/dist/go-httpbin* /bin/ EXPOSE 8080 CMD ["/bin/go-httpbin"] diff --git a/Makefile b/Makefile index 2ab6c8b7bfd6a470fad385febb940e4f35a5ec21..f9c9c5a4bec5d101aefeff433753a7fa5bb564db 100644 --- a/Makefile +++ b/Makefile @@ -33,10 +33,13 @@ build: $(DIST_PATH)/go-httpbin $(DIST_PATH)/go-httpbin: assets $(GO_SOURCES) mkdir -p $(DIST_PATH) - go build -o $(DIST_PATH)/go-httpbin ./cmd/go-httpbin + CGO_ENABLED=0 go build -ldflags="-s -w" -o $(DIST_PATH)/go-httpbin ./cmd/go-httpbin assets: $(GENERATED_ASSETS_PATH) +buildtests: + CGO_ENABLED=0 go test -ldflags="-s -w" -v -c -o $(DIST_PATH)/go-httpbin.test ./httpbin + clean: rm -rf $(DIST_PATH) $(COVERAGE_PATH) @@ -88,7 +91,7 @@ run: build # ============================================================================= # docker images # ============================================================================= -image: build +image: docker build -t mccutchen/go-httpbin:$(VERSION) . imagepush: image