diff --git a/Dockerfile b/Dockerfile index 1bb5e5b..9708ce4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,9 @@ FROM golang:1.10 AS goircd-builder ARG PACKAGE=github.com/bbusse/goircd ENV PACKAGE=$PACKAGE -WORKDIR /go/src/github.com/bbusse/goircd/ +WORKDIR /go/src/$PACKAGE/ -ADD . /go/src/github.com/bbusse/goircd/ +ADD . /go/src/$PACKAGE/ RUN export CGO_ENABLED=0 \ && go get $PACKAGE \ diff --git a/GNUmakefile b/GNUmakefile index 04d452d..c7aeb93 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,3 +1,4 @@ VERSION = $(shell git describe --tags) +PACKAGE ?= quay.io/goircd/goircd -include common.mk +include common.mk \ No newline at end of file diff --git a/common.mk b/common.mk index 888e048..ed5b175 100644 --- a/common.mk +++ b/common.mk @@ -2,3 +2,17 @@ LDFLAGS = -X main.version=$(VERSION) goircd: *.go go build -ldflags "$(LDFLAGS)" + +docker-image: *.go Dockerfile .dockerignore + docker build -t $(shell basename $(PACKAGE)):$(VERSION) . + +docker-image-push: docker-image-push-latest docker-image-push-version + @true + +docker-image-push-version: docker-image-push-latest docker-image-push-version + docker tag $(shell basename $(PACKAGE)):$(VERSION) $(PACKAGE):$(VERSION) + docker push $(PACKAGE):$(VERSION) + +docker-image-push-latest: docker-image + docker tag $(shell basename $(PACKAGE)):$(VERSION) $(PACKAGE):latest + docker push $(PACKAGE):latest