forked from mvlm/counter-strike-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (49 loc) · 1.45 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Build options
IMAGE_NAME?="hlds"
IMAGE_TAG?="alpha"
STEAM_USER?="anonymous"
STEAM_PASSWORD?=""
DOCKER_NO_CACHE?="false"
# Publish options
DOCKER_PUBLISH_NAME?="joelkobjoll/hlds"
DOCKER_PUBLISH_TAG?=$(IMAGE_TAG)
# Test tools
SHELLCHECK_IMAGE?="koalaman/shellcheck:v0.4.6"
TEST_CONTAINER_NAME?="test_hlds_auto"
TEST_CONTAINER_PORT?="27111"
HLDS_NAME?="Test auto"
HLDS_MAP?="de_dust2"
.PHONY: build
build:
docker build -f Dockerfile --no-cache=$(DOCKER_NO_CACHE) \
-t $(IMAGE_NAME):$(IMAGE_TAG) \
--build-arg steam_user=$(STEAM_USER) \
--build-arg steam_password=$(STEAM_PASSWORD) .
.PHONY: test
test: shellcheck test-smoke test-clean
.PHONY: shellcheck
shellcheck:
docker run --rm -v $(PWD):/code \
--entrypoint sh $(SHELLCHECK_IMAGE) -c \
"find /code/ -type f -name '*.sh' | xargs shellcheck"
.PHONY: test-start-server
test-start-server:
$(MAKE) test-stop-server
docker run -d -p $(TEST_CONTAINER_PORT):27015/udp \
-e START_MAP=$(HLDS_MAP) -e SERVER_NAME=$(HLDS_NAME) \
--name $(TEST_CONTAINER_NAME) $(IMAGE_NAME):$(IMAGE_TAG)
.PHONY: test-stop-server
test-stop-server:
-docker rm -f $(TEST_CONTAINER_NAME)
.PHONY: test-smoke
test-smoke: test-start-server
tests/smoke.py
.PHONY: test-clean
test-clean: test-stop-server
.PHONY: clean
clean: test-clean
-docker rmi $(IMAGE_NAME):$(IMAGE_TAG)
.PHONY: publish
publish:
docker tag $(IMAGE_NAME):$(IMAGE_TAG) $(DOCKER_PUBLISH_NAME):$(DOCKER_PUBLISH_TAG)
docker push $(DOCKER_PUBLISH_NAME):$(DOCKER_PUBLISH_TAG)