<commit_before>GOC=go build
GOFLAGS=-a -ldflags '-s'
CGOR=CGO_ENABLED=0
VER_NUM=latest
DOCKER_OPTIONS="--no-cache"
IMAGE_NAME=docker.io/unixvoid/beacon:$(VER_NUM)
REDIS_DB_HOST_DIR="/tmp/"

all: beacon

beacon: beacon.go
	$(GOC) beacon.go

dependencies:
	go get github.com/gorilla/mux
	go get golang.org/x/crypto/sha3
	go get gopkg.in/gcfg.v1
	go get gopkg.in/redis.v3
	go get github.com/unixvoid/glogger

run:
	cd beacon && go run \
	beacon.go \
	provision.go \
	remove.go \
	rotate.go \
	update.go

stat:
	mkdir -p bin/
	$(CGOR) $(GOC) $(GOFLAGS) -o bin/beacon beacon/*.go

test:
	go test -v beacon/*.go

install: stat
	cp beacon /usr/bin

docker:
	$(MAKE) stat
	mkdir stage.tmp/
	cp beacon stage.tmp/
	cp deps/rootfs.tar.gz stage.tmp/
	cp deps/Dockerfile stage.tmp/
	sed -i "s/<DIFF>/$(shell git rev-parse HEAD | head -c 10)/g" stage.tmp/Dockerfile
	chmod +x deps/run.sh
	cp deps/run.sh stage.tmp/
	cp config.gcfg stage.tmp/
	cd stage.tmp/ && \
		sudo docker build $(DOCKER_OPTIONS) -t $(IMAGE_NAME) .
	@echo "$(IMAGE_NAME) built"
dockerrun:
	sudo docker run \
		-d \
		-p 8808:8808 \
		--name beacon \
		-v $(REDIS_DB_HOST_DIR):/redisbackup/:rw \
		mfaltys/beacon
	sudo docker logs -f beacon

clean:
	rm -rf bin/
	rm -rf stage.tmp/
#CGO_ENABLED=0 go build -a -ldflags '-s' beacon.go<commit_msg>Fix new directory structure for Docker build<commit_after>GOC=go build
GOFLAGS=-a -ldflags '-s'
CGOR=CGO_ENABLED=0
VER_NUM=latest
DOCKER_OPTIONS="--no-cache"
IMAGE_NAME=docker.io/unixvoid/beacon:$(VER_NUM)
REDIS_DB_HOST_DIR="/tmp/"

all: beacon

beacon: beacon.go
	$(GOC) beacon.go

dependencies:
	go get github.com/gorilla/mux
	go get golang.org/x/crypto/sha3
	go get gopkg.in/gcfg.v1
	go get gopkg.in/redis.v3
	go get github.com/unixvoid/glogger

run:
	cd beacon && go run \
	beacon.go \
	provision.go \
	remove.go \
	rotate.go \
	update.go

stat:
	mkdir -p bin/
	$(CGOR) $(GOC) $(GOFLAGS) -o bin/beacon beacon/*.go

test:
	go test -v beacon/*.go

install: stat
	cp beacon /usr/bin

docker:
	$(MAKE) stat
	mkdir stage.tmp/
	cp bin/beacon stage.tmp/
	cp deps/rootfs.tar.gz stage.tmp/
	cp deps/Dockerfile stage.tmp/
	sed -i "s/<DIFF>/$(shell git rev-parse HEAD | head -c 10)/g" stage.tmp/Dockerfile
	chmod +x deps/run.sh
	cp deps/run.sh stage.tmp/
	cp beacon/config.gcfg stage.tmp/
	cd stage.tmp/ && \
		sudo docker build $(DOCKER_OPTIONS) -t $(IMAGE_NAME) .
	@echo "$(IMAGE_NAME) built"
dockerrun:
	sudo docker run \
		-d \
		-p 8808:8808 \
		--name beacon \
		-v $(REDIS_DB_HOST_DIR):/redisbackup/:rw \
		unixvoid/beacon
	sudo docker logs -f beacon

clean:
	rm -rf bin/
	rm -rf stage.tmp/
#CGO_ENABLED=0 go build -a -ldflags '-s' beacon.go
{'fraction_non_alphanumeric': 0.14475179992421372, 'fraction_numerical': 0.011367942402425162, 'mean_word_length': 3.1971383147853736, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '577655', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1147, 'n_words': 279}