GOC=go build GOFLAGS=-a -ldflags '-s' CGOR=CGO_ENABLED=0 IMAGE_NAME=lorebot all: lorebot depends: go get github.com/unixvoid/glogger go get gopkg.in/gcfg.v1 go get gopkg.in/redis.v5 go get github.com/bwmarrin/discordgo lorebot: $(GOC) lorebot/lorebot.go run: go run \ lorebot/lorebot.go \ lorebot/botfunc.go stat: mkdir -p bin/ $(CGOR) $(GOC) -o bin/lorebot $(GOFLAGS) lorebot/*.go docker: stat mkdir stage.tmp/ cp bin/lorebot stage.tmp/ cp deps/rootfs.tar.gz stage.tmp/ cp deps/Dockerfile stage.tmp/ cp deps/redis.conf stage.tmp/ chmod +x deps/run.sh cp deps/run.sh stage.tmp/ cp -R deps/fortune stage.tmp/ cp config.gcfg stage.tmp/ cd stage.tmp/ && \ sudo docker build -t $(IMAGE_NAME) . @echo "$(IMAGE_NAME) built" test_docker: mkdir -p /tmp/lorebot/redis/ touch /tmp/lorebot/dump.rdb cp .auth /tmp/lorebot/ sudo docker run \ -it \ -v /tmp/lorebot/redis:/redisbackup:rw \ -v /tmp/lorebot/.auth:/.auth:ro \ $(IMAGE_NAME) clean: rm -rf bin/ rm -rf stage.tmp/ rm -rf lorebot.aci