<commit_before>PROJECT ?= mqtt-proxy
EB_BUCKET ?= ninjablocks-sphere-docker

APP_NAME ?= mqtt-proxy
APP_ENV ?= mqtt-proxy-prod

SHA1 := $(shell git rev-parse --short HEAD | tr -d "\n")

DOCKERRUN_FILE := Dockerrun.aws.json
APP_FILE := ${SHA1}.zip

build:
	docker build -t "ninjablocks/${PROJECT}:${SHA1}" .

push:
	docker push "ninjablocks/${PROJECT}:${SHA1}"

services:
	docker run --name ninja-rabbit -p 5672:5672 -p 15672:15672 -d mikaelhg/docker-rabbitmq

local:
	docker run -t -i --rm --link ninja-rabbit:rabbit -e "DEBUG=true" \
		-p 6300:6300 -t "ninjablocks/${PROJECT}:${SHA1}"

deploy:
	sed "s/<TAG>/${SHA1}/" < Dockerrun.aws.json.template > ${DOCKERRUN_FILE}
	zip -r ${APP_FILE} ${DOCKERRUN_FILE} .ebextensions

	aws s3 cp ${APP_FILE} s3://${EB_BUCKET}/${APP_ENV}/${APP_FILE}

	aws elasticbeanstalk create-application-version --application-name ${APP_NAME} \
	   --version-label ${SHA1} --source-bundle S3Bucket=${EB_BUCKET},S3Key=${APP_ENV}/${APP_FILE}

	# # Update Elastic Beanstalk environment to new version
	aws elasticbeanstalk update-environment --environment-name ${APP_ENV} \
       --version-label ${SHA1}

clean:
	rm *.zip || true
	rm ${DOCKERRUN_FILE} || true
	rm -rf build || true

.PHONY: all build push local services deploy clean
<commit_msg>Add rule for making binary outside of Dockerfile.<commit_after>PROJECT ?= mqtt-proxy
EB_BUCKET ?= ninjablocks-sphere-docker

APP_NAME ?= mqtt-proxy
APP_ENV ?= mqtt-proxy-prod

SHA1 := $(shell git rev-parse --short HEAD | tr -d "\n")

DOCKERRUN_FILE := Dockerrun.aws.json
APP_FILE := ${SHA1}.zip

build:
	docker build -t "ninjablocks/${PROJECT}:${SHA1}" .

push:
	docker push "ninjablocks/${PROJECT}:${SHA1}"

services:
	docker run --name ninja-rabbit -p 5672:5672 -p 15672:15672 -d mikaelhg/docker-rabbitmq

local:
	docker run -t -i --rm --link ninja-rabbit:rabbit -e "DEBUG=true" \
		-p 6300:6300 -t "ninjablocks/${PROJECT}:${SHA1}"

binary:
	dodep restore
	go build -ldflags "\
       -X main.buildVersion  $(grep "const Version " version.go | sed -E 's/.*"(.+)"$/\1/' ) \
       -X main.buildRevision $(git rev-parse --short HEAD) \
       -X main.buildBranch   $(git rev-parse --abbrev-ref HEAD) \
       -X main.buildDate     $(date +%Y%m%d-%H:%M:%S) \
       -X main.goVersion     $GOLANG_VERSION \
    "

deploy:
	sed "s/<TAG>/${SHA1}/" < Dockerrun.aws.json.template > ${DOCKERRUN_FILE}
	zip -r ${APP_FILE} ${DOCKERRUN_FILE} .ebextensions

	aws s3 cp ${APP_FILE} s3://${EB_BUCKET}/${APP_ENV}/${APP_FILE}

	aws elasticbeanstalk create-application-version --application-name ${APP_NAME} \
	   --version-label ${SHA1} --source-bundle S3Bucket=${EB_BUCKET},S3Key=${APP_ENV}/${APP_FILE}

	# # Update Elastic Beanstalk environment to new version
	aws elasticbeanstalk update-environment --environment-name ${APP_ENV} \
       --version-label ${SHA1}

clean:
	rm *.zip || true
	rm ${DOCKERRUN_FILE} || true
	rm -rf build || true

.PHONY: all build push local services deploy clean

{'fraction_non_alphanumeric': 0.16514072566971855, 'fraction_numerical': 0.02611054594777891, 'mean_word_length': 3.704944178628389, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5403553', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1117, 'n_words': 265}