-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (31 loc) · 858 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Define variables
APP_NAME := podprox
CMD_DIR := ./cmd/$(APP_NAME)
MAIN_FILE := $(CMD_DIR)/main.go
BIN_DIR := ./bin
BIN_FILE := $(BIN_DIR)/$(APP_NAME)
GO_FILES := $(shell find . -name '*.go' -not -path './vendor/*')
# Define build commands
all: build
build: $(GO_FILES)
@echo "Building $(APP_NAME)"
@mkdir -p $(BIN_DIR)
@go build -o $(BIN_FILE) $(MAIN_FILE)
@echo "Build complete. Binary is located at $(BIN_FILE)."
image: $(GO_FILES)
@echo "Building Docker Image"
@docker build -t podprox .
k8s: k8s/podprox.yaml
@echo "Starting k8s pod"
@kubectl apply -f k8s/podprox.yaml
k8s-clean: k8s/podprox.yaml
@echo "Starting k8s pod"
@kubectl delete -f k8s/podprox.yaml
run: build
@echo "Running $(APP_NAME)..."
@$(BIN_FILE)
clean:
@echo "Cleaning up..."
@rm -rf $(BIN_DIR)
@echo "Clean complete."
.PHONY: all build run test clean fmt vet