aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 902cb2f34c8f2d58c9d26aeb65565ca17c1a9cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.PHONY: build

CONTAINERNAME=thornycrackers_scrapy_example
IMAGENAME=thornycrackers/scrapy_example

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

build: ## Build the Docker image
	cp -r requirements.txt ./build
	docker build -t $(IMAGENAME) ./build

up: build ## Bring the container up
	docker run -dP -v $(CURDIR):/app --name $(CONTAINERNAME) $(IMAGENAME) /bin/bash -c '/opt/entry.sh'

down: ## Stop the container
	docker stop $(CONTAINERNAME) || echo 'No container to stop'

enter: ## Enter the running container
	docker exec -it $(CONTAINERNAME) /bin/bash

clean: down ## Remove the image and any stopped containers
	docker rm $(CONTAINERNAME) || echo 'No container to remove'