before things get out of hand

main
Nick Dumas 2 years ago
parent 04919ea208
commit 135591cd0b

@ -2,9 +2,10 @@ FROM golang:latest AS builder
ADD . /opt/obp ADD . /opt/obp
WORKDIR /opt/obp WORKDIR /opt/obp
# RUN go build -o baas cmd/main.go # RUN go build -o baas cmd/main.go
RUN make alpine-binary RUN make build-alpine
FROM alpine:latest FROM alpine:latest
RUN apk --no-cache add ca-certificates RUN apk --no-cache add ca-certificates
COPY --from=builder /opt/obp/bin/obp-alpine /bin/obp ARG VERSION=*
COPY --from=builder /opt/obp/dist/obp-$VERSION-alpine_amda64/obp /bin/obp
RUN chmod +x /bin/obp RUN chmod +x /bin/obp

@ -5,12 +5,17 @@ docker: docker-image docker-push
.PHONY: docker-push .PHONY: docker-push
docker-push: docker-push:
$(DOCKER_CMD) pull code.ndumas.com/ndumas/obsidian-pipeline:$(VERSION)
$(DOCKER_CMD) tag code.ndumas.com/ndumas/obsidian-pipeline:$(VERSION) code.ndumas.com/ndumas/obsidian-pipeline:latest
$(DOCKER_CMD) push code.ndumas.com/ndumas/obsidian-pipeline:latest $(DOCKER_CMD) push code.ndumas.com/ndumas/obsidian-pipeline:latest
.PHONY: docker-image .PHONY: docker-image
docker-image: docker-image:
$(DOCKER_CMD) build -t code.ndumas.com/ndumas/obsidian-pipeline:latest . $(DOCKER_CMD) build --build-arg VERSION=$(VERSION) -t code.ndumas.com/ndumas/obsidian-pipeline:$(VERSION) .
.PHONE: build-alpine
build-alpine:
CGO_ENABLED=0 go build -a -installsuffix cgo -o $(DISTDIR)/$(NAME)-$(VERSION)-alpine_amd64/obp cmd/obp/cmd/*.go
# This file is intended as a starting point for a customized makefile for a Go project. # This file is intended as a starting point for a customized makefile for a Go project.
# #
@ -86,8 +91,7 @@ ARCHES ?= amd64 386
OSES ?= windows linux darwin OSES ?= windows linux darwin
OUTTPL = $(DISTDIR)/$(NAME)-$(VERSION)-{{.OS}}_{{.Arch}}/{{.Dir}} OUTTPL = $(DISTDIR)/$(NAME)-$(VERSION)-{{.OS}}_{{.Arch}}/{{.Dir}}
LDFLAGS = -X $(PKG).Version=$(VERSION) -X $(PKG).Build=$(COMMIT_ID) LDFLAGS = -X $(PKG).Version=$(VERSION) -X $(PKG).Build=$(COMMIT_ID)
GOBUILD = gox -rebuild -gocmd="$(GOCMD)" -arch="$(ARCHES)" -os="$(OSES)" -output="$(OUTTPL)" -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)" GOBUILD = gox -osarch="!darwin/386" -rebuild -gocmd="$(GOCMD)" -arch="$(ARCHES)" -os="$(OSES)" -output="$(OUTTPL)" -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)"
GOBUILD_SIMPLE = go build -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)"
GOCLEAN = $(GOCMD) clean GOCLEAN = $(GOCMD) clean
GOINSTALL = $(GOCMD) install -a -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)" GOINSTALL = $(GOCMD) install -a -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)"
GOTEST = $(GOCMD) test -v -tags "$(BUILD_TAGS)" GOTEST = $(GOCMD) test -v -tags "$(BUILD_TAGS)"

Loading…
Cancel
Save