ensl_hlds/Makefile

46 lines
1.2 KiB
Makefile
Raw Normal View History

REGISTRY ?= ensl
PROJECT ?= ensl_hlds
TAG ?= latest
2018-10-26 23:45:48 +00:00
.PHONY: all clean build stop run pull push
ifdef REGISTRY
IMAGE=$(REGISTRY)/$(PROJECT):$(TAG)
else
IMAGE=$(PROJECT):$(TAG)
endif
all:
@echo "Available targets:"
@echo " * build - build a Docker image for $(IMAGE)"
@echo " * pull - pull $(IMAGE)"
@echo " * push - push $(IMAGE)"
@echo " * test - build and test $(IMAGE)"
build: Dockerfile
docker build -t $(IMAGE) .
run: build
2018-04-18 21:01:53 +00:00
mkdir -p logs
2018-04-18 21:38:02 +00:00
#docker run -p 27015:27015 27015/udp:27015/udp -v $(shell pwd)/logs:/home/steam/hlds/ns/logs -ti $(IMAGE)
2018-10-26 23:45:48 +00:00
# docker run --name=$(PROJECT) --net=host -v $(shell pwd)/logs:/home/steam/hlds/ns/logs -ti $(IMAGE)
docker run -e HLDS='1' --name=$(PROJECT) --net=host -v $(shell pwd)/logs:/home/steam/hlds/ns/logs -ti $(IMAGE)
stop:
docker stop $(PROJECT)
docker rm $(PROJECT)
2018-04-18 21:01:53 +00:00
shell:
2018-10-26 23:45:48 +00:00
docker exec -u0 -ti $(PROJECT) /bin/bash
# docker run --name=$(PROJECT) --net=host -v $(shell pwd)/logs:/home/steam/hlds/ns/logs -u0 -ti $(IMAGE) /bin/bash
pull:
docker pull $(IMAGE) || true
push:
docker push $(IMAGE)
clean:
docker ps -a | awk '{ print $$1,$$2 }' | grep $(IMAGE) |awk '{print $$1 }' |xargs -I {} docker rm {}
docker images -a |grep $(IMAGE) |awk '{print $$3}' |xargs -I {} docker rmi {}