Skip to content

Instantly share code, notes, and snippets.

@sboardwell
Last active July 18, 2024 09:23
Show Gist options
  • Save sboardwell/374bc07d3de5dae67e8a3e8ff25e6832 to your computer and use it in GitHub Desktop.
Save sboardwell/374bc07d3de5dae67e8a3e8ff25e6832 to your computer and use it in GitHub Desktop.
.DEFAULT_GOAL := help
SHELL := /bin/bash
MAKEFLAGS += --no-print-directory
MKFILE_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
DOCKER_IMAGE := ghcr.io/tsmp-falcon-platform/ci-bundle-utils:v0.3.3
DOCKER_NAME := bundleutils
.ONESHELL:
.PHONY: start
start: ## Start the bundleutils container
@docker run \
-d \
-v bundleutils-cache:/opt/bundleutils/.cache \
--name $(DOCKER_NAME) \
--entrypoint bash \
-e CASC_VALIDATION_LICENSE_KEY_B64=$$(cat license.key | base64 -w0) \
-e CASC_VALIDATION_LICENSE_CERT_B64=$$(cat license.crt | base64 -w0) \
-v $$(pwd):$$(pwd) \
-w $$(pwd) \
-u $$(id -u):$$(id -g) \
$(DOCKER_IMAGE) \
-c "tail -f /dev/null"
.PHONY: stop
stop: ## Stop the bundleutils container
@docker stop $(DOCKER_NAME)
.PHONY: enter
enter: ## Enter the bundleutils container
@docker exec -it $(DOCKER_NAME) bash
.PHONY: remove
remove: ## Remove the bundleutils container
@docker rm $(DOCKER_NAME)
.PHONY: help
help: ## Makefile Help Page
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[\/\%a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-21s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) 2>/dev/null
.PHONY: guard-%
guard-%:
@if [[ "${${*}}" == "" ]]; then echo "Environment variable $* not set"; exit 1; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment