include updates from other repo
This commit is contained in:
parent
2e58070467
commit
735118c87c
|
@ -1,6 +1,6 @@
|
||||||
FROM golang:1.13 as builder
|
FROM golang:1.13 as builder
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/sneak/pooteeweet
|
WORKDIR /go/src/github.com/sneak/merp
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN go get -v && make build
|
RUN go get -v && make build
|
||||||
|
@ -8,8 +8,11 @@ RUN go get -v && make build
|
||||||
|
|
||||||
FROM alpine
|
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
|
# FIXME add testing
|
||||||
|
|
29
Makefile
29
Makefile
|
@ -1,16 +1,20 @@
|
||||||
|
APPNAME := merp
|
||||||
|
|
||||||
VERSION := $(shell git rev-parse --short HEAD)
|
VERSION := $(shell git rev-parse --short HEAD)
|
||||||
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
|
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
|
||||||
BUILDUSER := $(shell whoami)
|
BUILDUSER := $(shell whoami)
|
||||||
BUILDHOST := $(shell hostname -s)
|
BUILDHOST := $(shell hostname -s)
|
||||||
BUILDARCH := $(shell uname -m)
|
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.Version=$(VERSION)
|
||||||
GOLDFLAGS += -X main.Buildtime=$(BUILDTIME)
|
GOLDFLAGS += -X main.Buildtime=$(BUILDTIME)
|
||||||
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
|
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
|
||||||
GOLDFLAGS += -X main.Buildarch=$(BUILDARCH)
|
GOLDFLAGS += -X main.Buildarch=$(BUILDARCH)
|
||||||
GOLDFLAGS += -X main.Appname=$(APPNAME)
|
GOLDFLAGS += -X main.Appname=$(APPNAME)
|
||||||
GOFLAGS = -ldflags "$(GOLDFLAGS)"
|
GOFLAGS = -ldflags "-linkmode external -extldflags -static $(GOLDFLAGS)"
|
||||||
|
|
||||||
default: run
|
default: run
|
||||||
|
|
||||||
|
@ -28,14 +32,23 @@ clean:
|
||||||
fmt:
|
fmt:
|
||||||
go fmt *.go
|
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
|
hub: upload-docker-image
|
||||||
docker push sneak/$(APPNAME)
|
|
||||||
|
|
||||||
build-image:
|
build-docker-image:
|
||||||
docker build \
|
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
|
||||||
|
|
2
merp.go
2
merp.go
|
@ -7,11 +7,13 @@ import "time"
|
||||||
import "github.com/rs/zerolog/log"
|
import "github.com/rs/zerolog/log"
|
||||||
import "github.com/gin-gonic/gin"
|
import "github.com/gin-gonic/gin"
|
||||||
|
|
||||||
|
/*
|
||||||
func GetLatestMerps() gin.HandlerFunc {
|
func GetLatestMerps() gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetLatestMerp() gin.HandlerFunc {
|
func GetLatestMerp() gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func HandleNewMerp() gin.HandlerFunc {
|
func HandleNewMerp() gin.HandlerFunc {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue