diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..73ca74c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:latest AS builder +ADD . /opt/obp +WORKDIR /opt/obp +# RUN go build -o baas cmd/main.go +RUN make alpine-binary + +FROM alpine:latest +RUN apk --no-cache add ca-certificates +COPY --from=builder /opt/obp/bin/obp-alpine /bin/obp +RUN chmod +x /bin/obp diff --git a/Makefile b/Makefile index ed76378..c24c0cf 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,24 @@ BINARY_NAME=obp -build-all: +docker: docker-image docker-push + +docker-push: + docker push code.ndumas.com/ndumas/obsidian-pipeline:latest + +docker-image: + docker build -t code.ndumas.com/ndumas/obsidian-pipeline:latest . + +alpine-binary: + CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/${BINARY_NAME}-alpine cmd/obp/cmd/*.go + +build-all: alpine-binary GOOS=darwin GOARCH=amd64 go build -o bin/${BINARY_NAME}-darwin cmd/obp/*.go GOOS=linux GOARCH=amd64 go build -o bin/${BINARY_NAME}-linux cmd/obp/*.go GOOS=windows GOARCH=amd64 go build -o bin/${BINARY_NAME}-windows.exe cmd/obp/*.go clean-all: go clean - rm bin/${BINARY_NAME}-darwin - rm bin/${BINARY_NAME}-linux - rm bin/${BINARY_NAME}-windows.exe + rm -v bin/* test: go test ./...