-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (45 loc) · 1.16 KB
/
Makefile
File metadata and controls
61 lines (45 loc) · 1.16 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
APP_NAME := wordle-ssh
CMD_DIR := ./cmd
BIN_DIR := ./bin
# Detect OS
ifeq ($(OS),Windows_NT)
BINARY := $(APP_NAME).exe
MKDIR_CMD := powershell -Command "if (!(Test-Path $(BIN_DIR))) { New-Item -ItemType Directory -Path $(BIN_DIR) | Out-Null }"
RM_CMD := powershell -Command "if (Test-Path $(BIN_DIR)) { Remove-Item -Recurse -Force $(BIN_DIR) }"
RUN_BINARY := $(BIN_DIR)\$(BINARY)
else
BINARY := $(APP_NAME)
MKDIR_CMD := mkdir -p $(BIN_DIR)
RM_CMD := rm -rf $(BIN_DIR)
RUN_BINARY := $(BIN_DIR)/$(BINARY)
endif
.PHONY: all build run clean test fmt vet tidy docker-build docker-run docker-stop docker-clean docker-up docker-down
all: build
build:
@$(MKDIR_CMD)
go build -o $(BIN_DIR)/$(BINARY) $(CMD_DIR)
run: build
$(RUN_BINARY)
clean:
@$(RM_CMD)
tidy:
go mod tidy
fmt:
gofmt -w .
vet:
go vet ./...
test:
go test ./...
docker-build:
docker build -t wordle-ssh:latest .
docker-run:
docker run -d -p 23234:23234 --name wordle-ssh wordle-ssh:latest
docker-stop:
docker stop wordle-ssh || true
docker rm wordle-ssh || true
docker-clean: docker-stop
docker rmi wordle-ssh:latest || true
docker-up:
docker-compose up -d
docker-down:
docker-compose down