add docker build, makefile, and some more shit before we move forward
This commit is contained in:
42
Makefile
Normal file
42
Makefile
Normal file
@@ -0,0 +1,42 @@
|
||||
IMAGE_NAME := maru-hleda-byt
|
||||
CONTAINER_NAME := maru-hleda-byt
|
||||
VOLUME_NAME := maru-hleda-byt-data
|
||||
PORT := 8080
|
||||
|
||||
.PHONY: build run stop logs scrape restart clean help
|
||||
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " build - Build the Docker image"
|
||||
@echo " run - Build and run the Docker container in the background"
|
||||
@echo " stop - Stop and remove the running container"
|
||||
@echo " logs - Show live container logs"
|
||||
@echo " scrape - Run the scraping script inside the container"
|
||||
@echo " restart - Restart the container (stop and run again)"
|
||||
@echo " clean - Stop container and remove the Docker image"
|
||||
@echo " help - Show this help message"
|
||||
|
||||
build:
|
||||
docker build -f build/Dockerfile -t $(IMAGE_NAME) .
|
||||
|
||||
run: build
|
||||
docker run -d --name $(CONTAINER_NAME) \
|
||||
-p $(PORT):8080 \
|
||||
-v $(VOLUME_NAME):/app/data \
|
||||
--restart unless-stopped \
|
||||
$(IMAGE_NAME)
|
||||
@echo "Map will be at http://localhost:$(PORT)/mapa_bytu.html"
|
||||
|
||||
stop:
|
||||
docker stop $(CONTAINER_NAME) && docker rm $(CONTAINER_NAME)
|
||||
|
||||
logs:
|
||||
docker logs -f $(CONTAINER_NAME)
|
||||
|
||||
scrape:
|
||||
docker exec $(CONTAINER_NAME) bash /app/run_all.sh
|
||||
|
||||
restart: stop run
|
||||
|
||||
clean: stop
|
||||
docker rmi $(IMAGE_NAME)
|
||||
Reference in New Issue
Block a user