# Variables
container_name := "rest-cobol-app"
image_name := "rest-cobol"

# Build the docker image
build:
    docker build -t {{image_name}} .

# Run the image in the foreground
run: build
    docker run --name {{container_name}} -p 8080:8080 {{image_name}}

# Run the image in the background (detached)
run-d: build
    docker run -d --name {{container_name}} -p 8080:8080 {{image_name}}

# Stop the running container
stop:
    docker stop {{container_name}}

# Remove the container
rm:
    docker rm {{container_name}}

# Stop and remove the container in one command
clean: stop rm