-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
24 lines (19 loc) · 886 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
IMAGE_REPO ?= quay.io/radudd/vault-bootstrap
IMAGE_NAME ?= vault-bootstrap
IMAGE_TAG ?= $$(git log --abbrev-commit --format=%h -s | head -n 1)
.PHONY: all build clean
build:
echo "Building app"
go build -mod=vendor -v -o ${IMAGE_NAME} ./cmd/vault-bootstrap/main.go
test:
echo "Running the tests for $(IMAGE_NAME)..."
go test ./...
image: build-image push-image
build-image: build
echo "Building the docker image: $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)..."
docker build -t $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) -f build/Dockerfile .
push-image: build-image
echo "Pushing the docker image for $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) and $(IMAGE_REPO)/$(IMAGE_NAME):latest..."
docker tag $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) $(IMAGE_REPO)/$(IMAGE_NAME):latest
docker push $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
docker push $(IMAGE_REPO)/$(IMAGE_NAME):latest