Merge pull request #4 from steigr/feature/docker-image
Added Dockerfile
This commit is contained in:
commit
cdbef56090
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
**/*
|
||||||
|
!.git/
|
||||||
|
!*.go
|
||||||
|
!GNUmakefile
|
||||||
|
!common.mk
|
||||||
|
!Dockerfile
|
||||||
|
!.dockerignore
|
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
FROM golang:1.10 AS goircd-builder
|
||||||
|
ARG PACKAGE=github.com/bbusse/goircd
|
||||||
|
ENV PACKAGE=$PACKAGE
|
||||||
|
|
||||||
|
WORKDIR /go/src/$PACKAGE/
|
||||||
|
|
||||||
|
ADD . /go/src/$PACKAGE/
|
||||||
|
|
||||||
|
RUN export CGO_ENABLED=0 \
|
||||||
|
&& go get $PACKAGE \
|
||||||
|
&& make -f GNUmakefile goircd \
|
||||||
|
&& mv goircd /go/bin/goircd
|
||||||
|
|
||||||
|
FROM alpine AS goircd
|
||||||
|
COPY --from=goircd-builder /go/bin/goircd /bin/goircd
|
||||||
|
ENTRYPOINT ["sh","-c"]
|
||||||
|
CMD ["exec goircd"]
|
@ -1,3 +1,4 @@
|
|||||||
VERSION = $(shell git describe --tags)
|
VERSION = $(shell git describe --tags)
|
||||||
|
PACKAGE ?= quay.io/goircd/goircd
|
||||||
|
|
||||||
include common.mk
|
include common.mk
|
||||||
|
14
common.mk
14
common.mk
@ -2,3 +2,17 @@ LDFLAGS = -X main.version=$(VERSION)
|
|||||||
|
|
||||||
goircd: *.go
|
goircd: *.go
|
||||||
go build -ldflags "$(LDFLAGS)"
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user