Add build files

This commit is contained in:
Stefan Prodan
2018-09-24 18:28:52 +03:00
parent e8f50b2c09
commit a4de083cfa
2 changed files with 45 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
FROM golang:1.10
RUN mkdir -p /go/src/github.com/stefanprodan/steerer/
WORKDIR /go/src/github.com/stefanprodan/steerer
COPY . .
RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") && \
VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') && \
GIT_COMMIT=$(git rev-list -1 HEAD) && \
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \
-X github.com/stefanprodan/steerer/pkg/version.VERSION=${VERSION} \
-X github.com/stefanprodan/steerer/pkg/version.REVISION=${GIT_COMMIT}" \
-a -installsuffix cgo -o steerer ./cmd/controller/*
FROM alpine:3.8
RUN addgroup -S app \
&& adduser -S -g app app \
&& apk --no-cache add ca-certificates
WORKDIR /home/app
COPY --from=0 /go/src/github.com/stefanprodan/steerer/steerer .
RUN chown -R app:app ./
USER app
ENTRYPOINT ["./steerer"]
CMD ["-logtostderr"]
+13
View File
@@ -0,0 +1,13 @@
TAG?=latest
build:
docker build -t stefanprodan/steerer:$(TAG) . -f Dockerfile
push:
docker push stefanprodan/steerer:$(TAG)
test:
go test ./...
verify-codegen:
./hack/verify-codegen.sh