<commit_before>VERSION ?= $(shell git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD)
REGISTRY ?= quay.io/
IMAGE_PREFIX ?= mozmar
IMAGE_NAME ?= viewsourceconf
IMAGE ?= ${REGISTRY}${IMAGE_PREFIX}/${IMAGE_NAME}\:${VERSION}
BUILD_IMAGE_NAME ?= ${IMAGE_NAME}_build
BUILD_IMAGE ?= ${REGISTRY}${IMAGE_PREFIX}/${BUILD_IMAGE_NAME}\:${VERSION}
WATCH_PORT ?= 8080
SERVE_PORT ?= 8000
MOUNT_DIR ?= $(shell pwd)
APP_DIR ?= /app
DOCKER_RUN_ARGS ?= -v ${MOUNT_DIR}\:${APP_DIR} -w ${APP_DIR}
HOST_IP ?= $(shell docker-machine ip || echo 127.0.0.1)
DEIS_PROFILE ?= usw
DEIS_APP ?= viewsourceconf-stage
PRIVATE_IMAGE ?= ${PRIVATE_REGISTRY}/${DEIS_APP}\:${VERSION}

.PHONY: build

build:
	docker run ${DOCKER_RUN_ARGS} ${BUILD_IMAGE} node build

watch:
	docker run ${DOCKER_RUN_ARGS} -p "${WATCH_PORT}:${WATCH_PORT}" ${BUILD_IMAGE} node watch 

build-build-image:
	docker build -f Dockerfile-build -t ${BUILD_IMAGE} .

push-build-image:
	docker push ${BUILD_IMAGE}

build-deploy-image:
	docker build -t ${IMAGE} .

push-deploy-image:
	docker push ${IMAGE}

serve:
	docker run -p "${SERVE_PORT}:80" ${IMAGE}

curl:
	curl -H "X-Forwarded-Proto: https" ${HOST_IP}:${SERVE_PORT}

deis-pull:
	deis pull ${IMAGE} -a ${DEIS_APP}

push-private-registry:
	docker tag ${IMAGE} ${PRIVATE_IMAGE}
	docker push ${PRIVATE_IMAGE}

deis-pull-private:
	deis pull ${DEIS_APP}:${VERSION} -a ${DEIS_APP}

build-deploy: build-build-image build build-deploy-image push-private-registry deis-pull-private<commit_msg>Use GIT_COMMIT in VERSION and push before pull<commit_after>GIT_COMMIT ?= HEAD
VERSION ?= $(shell git rev-parse --short ${GIT_COMMIT})
REGISTRY ?= quay.io/
IMAGE_PREFIX ?= mozmar
IMAGE_NAME ?= viewsourceconf
IMAGE ?= ${REGISTRY}${IMAGE_PREFIX}/${IMAGE_NAME}\:${VERSION}
BUILD_IMAGE_NAME ?= ${IMAGE_NAME}_build
BUILD_IMAGE ?= ${REGISTRY}${IMAGE_PREFIX}/${BUILD_IMAGE_NAME}\:${VERSION}
WATCH_PORT ?= 8080
SERVE_PORT ?= 8000
MOUNT_DIR ?= $(shell pwd)
APP_DIR ?= /app
DOCKER_RUN_ARGS ?= -v ${MOUNT_DIR}\:${APP_DIR} -w ${APP_DIR}
HOST_IP ?= $(shell docker-machine ip || echo 127.0.0.1)
DEIS_PROFILE ?= usw
DEIS_APP ?= viewsourceconf-stage
PRIVATE_IMAGE ?= ${PRIVATE_REGISTRY}/${DEIS_APP}\:${VERSION}

.PHONY: build

build:
	docker run ${DOCKER_RUN_ARGS} ${BUILD_IMAGE} node build

watch:
	docker run ${DOCKER_RUN_ARGS} -p "${WATCH_PORT}:${WATCH_PORT}" ${BUILD_IMAGE} node watch 

build-build-image:
	docker build -f Dockerfile-build -t ${BUILD_IMAGE} .

push-build-image:
	docker push ${BUILD_IMAGE}

build-deploy-image:
	docker build -t ${IMAGE} .

push-deploy-image:
	docker push ${IMAGE}

serve:
	docker run -p "${SERVE_PORT}:80" ${IMAGE}

curl:
	curl -H "X-Forwarded-Proto: https" ${HOST_IP}:${SERVE_PORT}

deis-pull:
	deis pull ${IMAGE} -a ${DEIS_APP}

push-private-registry:
	docker tag ${IMAGE} ${PRIVATE_IMAGE}
	docker push ${PRIVATE_IMAGE}

deis-pull-private: push-private-registry
	deis pull ${DEIS_APP}:${VERSION} -a ${DEIS_APP}

build-deploy: build-build-image build build-deploy-image push-private-registry deis-pull-private
{'fraction_non_alphanumeric': 0.16468646864686468, 'fraction_numerical': 0.01089108910891089, 'mean_word_length': 5.490364025695931, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6655087', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1168, 'n_words': 254}