Skip to content

Instantly share code, notes, and snippets.

@p-geon
Last active February 23, 2021 12:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p-geon/5570894cfa887b80fef4cb2d0e0e38e5 to your computer and use it in GitHub Desktop.
Save p-geon/5570894cfa887b80fef4cb2d0e0e38e5 to your computer and use it in GitHub Desktop.
GeneralPurpose for CC-56 Blog
## ENVs
# basic
export PWD=`pwd`
# docker
export CONTAINER_NAME=container_name
export DIR_DOCKER=docker
export DOCKERFILE_NAME=Dockerfile
export EXPOSED_PORT=8888
export CONTAINER_ID=`docker ps --format {{.ID}}`
# --------------------------------------------------------
br: ## build & run
@make b
@make r
b: ## build docker.
docker build -f $(DIR_DOCKER)/$(DOCKERFILE_NAME) -t $(CONTAINER_NAME) .
r: ## run docker.
docker run -it --rm --gpus all \
-p $(EXPOSED_PORT):$(EXPOSED_PORT) \
-v $(PWD):/work \
$(CONTAINER_NAME)
c: ## connect newest container
docker exec -i -t $(CONTAINER_ID) /bin/bash
# --------------------------------------------------------
# docker commands
export NONE_DOCKER_IMAGES=`docker images -f dangling=true -q`
export STOPPED_DOCKER_CONTAINERS=`docker ps -a -q`
clean: ## clean images/containers
-@make clean-images
-@make clean-containers
clean-images:
docker rmi $(NONE_DOCKER_IMAGES) -f
clean-containers:
docker rm -f $(STOPPED_DOCKER_CONTAINERS) \
# --------------------------------------------------------
jn: ## launch jupyter notebook
jupyter notebook --port $(EXPOSED_PORT) --ip="0.0.0.0" --allow-root
tensorflow-GPU-test: ## check tensorflow-GPU
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
# --------------------------------------------------------
# help
help: ## this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment