Skip to content

Instantly share code, notes, and snippets.

@EddiG
Created March 23, 2018 18:10
Show Gist options
  • Save EddiG/0fad75ff638e3d5ae8ef85b37dfda7a9 to your computer and use it in GitHub Desktop.
Save EddiG/0fad75ff638e3d5ae8ef85b37dfda7a9 to your computer and use it in GitHub Desktop.
The Makefile to leveraging Docker
image = 'node:8.9.3'
container = 'my-project'
volume = 'my-project-volume'
site_port = '8080:8080'

build:
	docker run -it -d -v '$(CURDIR)':/app -v ${volume}:/app/node_modules -w /app -p $(site_port) --name $(container) $(image) /bin/bash
	docker exec -it $(container) yarn install

clean: stop
	docker rm $(container)
	docker volume rm ${volume}

rebuild: clean build

stop: 
	docker stop $(container)

start: 
	docker start $(container)

connect: start
	docker exec -it $(container) /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment