IMAGE_NAME = laravel-app 
CONTAINER_NAME = laravel-app 
PORT = 8889
VERSION = "latest"

.PHONY: build run rebuild

# Make sure to get set up with octane and frankenPHP
# since that's what the base docker image expects
setup:
	composer require laravel/octane
	php artisan octane:install --server=frankenphp

# Build the Docker image
build:
	npm run build
	docker build -t $(IMAGE_NAME) .

# Run the container
run:
	docker run -it --rm -p $(PORT):8000 -e APP_DEBUG=true --name $(CONTAINER_NAME) $(IMAGE_NAME) 

# Rebuild (force rebuild without cache)
rebuild:
	docker build --no-cache -t $(IMAGE_NAME) .

docker-publish:
	docker image tag flowtodo:latest gitgud.foo/thegrind/flowtodo:$(VERSION)
	docker push gitgud.foo/thegrind/flowtodo:$(VERSION) 

test-remote-image:
	docker pull gitgud.foo/thegrind/flowtodo:latest
	docker run --rm -p 8889:8000 gitgud.foo/thegrind/flowtodo:latest
