diff --git a/.gitignore b/.gitignore index e720419..d608424 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,6 @@ bin *.out coverage.txt -.vscode - imposters !internal/server/http/test/testdata/imposters/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d22dbbe..65c9e8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,15 @@ FROM golang:1.21-alpine AS build -LABEL MAINTAINER='Friends of Go (it@friendsofgo.tech)' +LABEL MAINTAINER = 'Friends of Go (it@friendsofgo.tech)' ARG TARGETOS=linux ARG TARGETARCH=amd64 -ARG TAG="" RUN apk add --update git RUN apk add ca-certificates WORKDIR /go/src/github.com/friendsofgo/killgrave COPY . . -RUN go mod tidy \ - && if [ -z "$TAG" ]; then TAG=$(git describe --tags --abbrev=0); fi \ +RUN RUN go mod tidy && TAG=$(git describe --tags --abbrev=0) \ && LDFLAGS=$(echo "-s -w -X github.com/friendsofgo/killgrave/internal/app/cmd._version="docker-$TAG) \ && CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" go build -a -installsuffix cgo -o /go/bin/killgrave -ldflags "$LDFLAGS" cmd/killgrave/main.go diff --git a/Makefile b/Makefile index 6f58600..b773558 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,3 @@ .PHONY: build build: - go build -ldflags "-s -w -X 'github.com/friendsofgo/killgrave/internal/app/cmd._version=`git rev-parse --abbrev-ref HEAD`-`git rev-parse --short HEAD`'" -o bin/killgrave cmd/killgrave/main.go - -.PHONY: build-docker -build-docker: - docker build --build-arg TAG=$(TAG) -t killgrave:$(TAG) . - -.PHONY: test -test: - go test -v -vet=off -race ./... + go build -ldflags "-s -w -X 'github.com/friendsofgo/killgrave/internal/app/cmd._version=`git rev-parse --abbrev-ref HEAD`-`git rev-parse --short HEAD`'" -o bin/killgrave cmd/killgrave/main.go \ No newline at end of file