|
|
|
GOC=go build
|
|
|
|
GOFLAGS=-a -ldflags '-s'
|
|
|
|
CGOR=CGO_ENABLED=0
|
|
|
|
OS_PERMS=sudo
|
|
|
|
NETHACK_DIR=$(shell pwd)/savedata
|
|
|
|
IMAGE_NAME=nethack_launch
|
|
|
|
|
|
|
|
|
|
|
|
all: stat
|
|
|
|
|
|
|
|
run:
|
|
|
|
go run \
|
|
|
|
nethack-launcher.go
|
|
|
|
|
|
|
|
stat:
|
|
|
|
mkdir -p bin/
|
|
|
|
$(CGOR) $(GOC) $(GOFLAGS) -o bin/nethack-launcher nethack-launcher.go
|
|
|
|
|
|
|
|
dependencies:
|
|
|
|
go get github.com/gorilla/mux
|
|
|
|
|
|
|
|
build_docker:
|
|
|
|
mkdir -p stage.tmp/
|
|
|
|
cp deps/Dockerfile stage.tmp/
|
|
|
|
cp deps/server_config.gcfg stage.tmp/config.gcfg
|
|
|
|
cp bin/nethack-launcher stage.tmp/
|
|
|
|
cp deps/redis.conf stage.tmp/
|
|
|
|
cp deps/run.sh stage.tmp/
|
|
|
|
cp deps/nethackrc stage.tmp/
|
|
|
|
cp deps/chowner.sh stage.tmp/
|
|
|
|
cp deps/run_nethack.sh stage.tmp/
|
|
|
|
cd stage.tmp/ && \
|
|
|
|
$(OS_PERMS) docker build -t $(IMAGE_NAME) .
|
|
|
|
|
|
|
|
run_docker:
|
|
|
|
$(OS_PERMS) docker run \
|
|
|
|
-d \
|
|
|
|
--name=nethack \
|
|
|
|
--restart always \
|
|
|
|
$(IMAGE_NAME)
|
|
|
|
|
|
|
|
#-v $(NETHACK_DIR)/var:/opt/nethack/nethack.alt.org/nh343/var:rw \
|
|
|
|
#-v $(NETHACK_DIR)/dgldir:/opt/nethack/nethack.alt.org/dgldir:rw \
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf bin/
|
|
|
|
rm -rf stage.tmp/
|