-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d1b5eb
commit 185bbaf
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |