Build without cgo

This commit is contained in:
Martin Polden 2019-03-29 20:38:43 +01:00
parent 99f9556173
commit 3a91baab21
2 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,8 @@
FROM golang:1.12-stretch AS build
WORKDIR /go/src/github.com/mpolden/echoip
COPY . .
ENV GO111MODULE=on
# Must build without cgo because libc is unavailable in runtime image
ENV GO111MODULE=on CGO_ENABLED=0
RUN make
# Run

View File

@ -39,5 +39,10 @@ docker-build:
docker-login:
@echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
docker-push: docker-login
docker-test:
$(eval CONTAINER=$(shell docker run --rm --detach --publish-all $(DOCKER_IMAGE)))
$(eval DOCKER_PORT=$(shell docker port $(CONTAINER) | cut -d ":" -f 2))
curl -qfsS -m 5 localhost:$(DOCKER_PORT) > /dev/null; docker stop $(CONTAINER)
docker-push: docker-test docker-login
docker push $(DOCKER_IMAGE)