cml04-mediciones/Makefile

35 lines
797 B
Makefile
Raw Normal View History

2024-08-20 09:11:15 +02:00
# Variables
IMAGE_NAME = registry.espin.casa/cml04-mediciones
CONTAINER_NAME = cml04-mediciones
# Check if Docker or Podman is available
DOCKER := $(shell command -v docker 2> /dev/null)
PODMAN := $(shell command -v podman 2> /dev/null)
# Determine which command to use based on availability
ifdef DOCKER
DOCKER_CMD := docker
else ifdef PODMAN
DOCKER_CMD := podman
else
$(error "Neither Docker nor Podman is installed on this system.")
endif
# Build the Docker image
build:
$(DOCKER_CMD) build -t $(IMAGE_NAME) -f docker/Dockerfile .
# Run the container
run:
@templ generate
@$(DOCKER_CMD) run $(IMAGE_NAME)
# Stop and remove the container
stop:
$(DOCKER_CMD) stop $(CONTAINER_NAME)
$(DOCKER_CMD) rm $(CONTAINER_NAME)
# Remove the Docker image
clean:
$(DOCKER_CMD) rmi $(IMAGE_NAME)