-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (46 loc) · 1.41 KB
/
Makefile
File metadata and controls
64 lines (46 loc) · 1.41 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
62
63
64
# Optionally include .env file
-include .env
.IMAGES := `docker images --filter "dangling=true" -q --no-trunc`
.EXECUTABLE_NAME := rcon
.DEFAULT_GOAL := nothing
### CLI make options ###
# build go executable to root directory
build:
go build -o ./${.EXECUTABLE_NAME} ./cmd/gorcon
# need clean to remove both executable, and build directory if present
# with presence of build directory, `make build` thinks build is already complete
clean:
rm -rf ./build/
rm -rf rcon
### ---------- ###
### Docker make options ###
docker-clean:
docker rmi ${.IMAGES} 2> /dev/null ||:
docker-build:
docker build -f Dockerfile \
--build-arg VERSION="${VERSION}" \
-t outdead/rcon .
docker rmi ${.IMAGES} 2> /dev/null ||:
# example: make docker-run args="-e {environment_name}" command=players
docker-run:
docker run -it --rm \
-v $(CURDIR)/rcon-local.yaml:/rcon.yaml \
outdead/rcon ./rcon -c /rcon.yaml ${args} $(command)
### ---------- ###
### Compile / Release options ###
# If the first argument is "docker-deploy"...
ifeq (compile, $(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
compile:
sh scripts/local/compile.sh $(RUN_ARGS)
run:
sh scripts/local/run.sh
lint:
golangci-lint run
### ---------- ###
nothing:
@echo "nothing to do"