Create a Makefile for Docker

I think that using make in Python development is a fantastic idea. Reproducing someone’s work is difficult, and using Makefiles minimizes that guesswork. I created a simple Makefile for a Docker project from a previous post

build:
	docker build -t hello-world .

run:
	docker run -p 8000:8000 -v /Users/cjohnson/example/app:/usr/src/app hello-world

testapp:
	pytest test

The trick with Makefiles is that they expect you to use actual tabs. If you see the error below, then you’ll know that you’re indenting with spaces instead of tabs.

Makefile:2: *** missing separator.  Stop.

Leave a Reply

Your email address will not be published. Required fields are marked *