include updates from other repo
This commit is contained in:
parent
2e58070467
commit
735118c87c
@ -1,6 +1,6 @@
|
||||
FROM golang:1.13 as builder
|
||||
|
||||
WORKDIR /go/src/github.com/sneak/pooteeweet
|
||||
WORKDIR /go/src/github.com/sneak/merp
|
||||
COPY . .
|
||||
|
||||
RUN go get -v && make build
|
||||
@ -8,8 +8,11 @@ RUN go get -v && make build
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=builder /go/src/github.com/sneak/pooteeweet/pooteeweet /bin/pooteeweet
|
||||
COPY --from=builder /go/src/github.com/sneak/merp/merp /bin/merp
|
||||
|
||||
CMD /bin/pooteeweet
|
||||
# put the source in there too for safekeeping
|
||||
COPY --from=builder /go/src /usr/local/src/go
|
||||
|
||||
CMD /bin/merp
|
||||
|
||||
# FIXME add testing
|
||||
|
29
Makefile
29
Makefile
@ -1,16 +1,20 @@
|
||||
APPNAME := merp
|
||||
|
||||
VERSION := $(shell git rev-parse --short HEAD)
|
||||
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
|
||||
BUILDUSER := $(shell whoami)
|
||||
BUILDHOST := $(shell hostname -s)
|
||||
BUILDARCH := $(shell uname -m)
|
||||
APPNAME := merp
|
||||
BUILDTIMETAG := $(shell date -u '+%Y%m%d%H%M%S')
|
||||
BUILDTIMEFILENAME := $(shell date -u '+%Y%m%d-%H%M%SZ')
|
||||
IMAGENAME := sneak/$(APPNAME)
|
||||
|
||||
GOLDFLAGS += -X main.Version=$(VERSION)
|
||||
GOLDFLAGS += -X main.Buildtime=$(BUILDTIME)
|
||||
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
|
||||
GOLDFLAGS += -X main.Buildarch=$(BUILDARCH)
|
||||
GOLDFLAGS += -X main.Appname=$(APPNAME)
|
||||
GOFLAGS = -ldflags "$(GOLDFLAGS)"
|
||||
GOFLAGS = -ldflags "-linkmode external -extldflags -static $(GOLDFLAGS)"
|
||||
|
||||
default: run
|
||||
|
||||
@ -28,14 +32,23 @@ clean:
|
||||
fmt:
|
||||
go fmt *.go
|
||||
|
||||
test: build-image
|
||||
test: build-docker-image
|
||||
|
||||
build-and-push-image: push-image
|
||||
dist: build-docker-image
|
||||
-mkdir -p ./output
|
||||
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(APPNAME) > output/$(APPNAME)
|
||||
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(APPNAME).tbz2
|
||||
|
||||
push-image: build-image
|
||||
docker push sneak/$(APPNAME)
|
||||
hub: upload-docker-image
|
||||
|
||||
build-image:
|
||||
build-docker-image:
|
||||
docker build \
|
||||
-t sneak/$(APPNAME):$(VERSION) \
|
||||
-t $(IMAGENAME):$(VERSION) \
|
||||
-t $(IMAGENAME):latest \
|
||||
-t $(IMAGENAME):$(BUILDTIMETAG) \
|
||||
.
|
||||
|
||||
upload-docker-image: build-docker-image
|
||||
docker push $(IMAGENAME):$(VERSION)
|
||||
docker push $(IMAGENAME):$(BUILDTIMETAG)
|
||||
docker push $(IMAGENAME):latest
|
||||
|
Loading…
Reference in New Issue
Block a user