Docker builds and makefile to match

main
Nick Dumas 2 years ago
parent 93869409c3
commit 0bf889b60a

@ -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

@ -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 ./...

Loading…
Cancel
Save