Skip to content

Commit

Permalink
add docker build and push
Browse files Browse the repository at this point in the history
  • Loading branch information
den-vasyliev committed Oct 31, 2022
1 parent 4d1b5eb commit 185bbaf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.19 as builder

WORKDIR /go/src/app
COPY . .
RUN make build

FROM scratch
WORKDIR /
COPY --from=builder /go/src/app/kbot .
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["./kbot"]
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
APP=$(shell basename $(shell git remote get-url origin))
REGISTRY=denvasyliev
VERSION=$(shell git describe --tags --abbrev=0)-$(shell git rev-parse --short HEAD)
TARGETOS=linux #linux darwin windows
TARGETARCH=arm64 #amd64 arm64

format:
gofmt -s -w ./

lint:
golint

test:
go test -v

get:
go get

build: format get
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -v -o kbot -ldflags "-X="github.com/den-vasyliev/kbot/cmd.appVersion=${VERSION}

image:
docker build . -t ${REGISTRY}/${APP}:${VERSION}-${TARGETARCH}

push:
docker push ${REGISTRY}/${APP}:${VERSION}-${TARGETARCH}

clean:
rm -rf kbot
Binary file modified kbot
Binary file not shown.

0 comments on commit 185bbaf

Please sign in to comment.