Created
January 23, 2020 20:20
-
-
Save stanislaw/eea74df838786654cdef46f0f71bad95 to your computer and use it in GitHub Desktop.
RRRR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# Self-Documented Makefile | |
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | |
define HELP | |
If you are running this first time, follow these steps: | |
make image.create | |
make container.create | |
make container.run | |
endef | |
export HELP | |
.PHONY: help | |
help: ## Show this help message. | |
@grep -E '^[a-zA-Z_\.-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ | |
sort | \ | |
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | |
@echo "" | |
@echo "$$HELP" | |
################################################################################ | |
HOME_DIR=$(shell echo ~) | |
# $(error "$(HOME_DIR)") | |
IMAGE_NAME=docker-image-ubuntu-1604 | |
CONTAINER_NAME=docker-container-ubuntu-1604 | |
MOUNT_PATH_GUEST=/code | |
MOUNT_PATH_HOST=$(HOME_DIR)/_/code-mounted/ubuntu | |
container.run: ## Run container (image and container must exist). | |
docker start -ai $(CONTAINER_NAME) | |
container.create: ## Create container (create before running with .run). | |
docker run \ | |
--cap-add=SYS_PTRACE \ | |
--security-opt seccomp=unconfined \ | |
-p 5801:22 \ | |
--mount type=bind,source=$(MOUNT_PATH_HOST),target=$(MOUNT_PATH_GUEST) \ | |
-ti --name=$(CONTAINER_NAME) $(IMAGE_NAME) | |
container.delete: ## Delete container. | |
docker rm $(CONTAINER_NAME) | |
pull: | |
docker pull ubuntu:xenial | |
image.create: ## Creates Mull docker image. | |
docker build -t $(IMAGE_NAME) . | |
image.delete: ## Deletes Mull docker image. | |
docker image rm $(IMAGE_NAME) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment