-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (24 loc) · 907 Bytes
/
Makefile
File metadata and controls
29 lines (24 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
IMAGE ?= squid:dev
COMPOSE := docker compose
BUILD_CTX := .
.PHONY: build run clean
build:
@echo "🔨 Building image $(IMAGE)..."
docker build -t $(IMAGE) $(BUILD_CTX)
run:
@echo "▶️ Starting docker compose with SQUID_CONTAINER_IMAGE=$(IMAGE)"
@SQUID_CONTAINER_IMAGE=$(IMAGE) $(COMPOSE) up -d && echo "✅ Started SQUID container using $(IMAGE)"
sbom: build
docker create --name temp-squid-container $(IMAGE)
docker cp temp-squid-container:/sbom.spdx.json ./sbom.spdx.json
docker rm temp-squid-container
clean:
@echo "🧹 Cleaning up: stopping compose and removing image/container if present"
-$(COMPOSE) down -v >/dev/null 2>&1 || true
-docker rm -f squid >/dev/null 2>&1 || true
@if docker image inspect $(IMAGE) >/dev/null 2>&1; then \
echo "🗑️ Removing image $(IMAGE)"; \
docker image rm -f $(IMAGE); \
else \
echo "⚠️ Image $(IMAGE) not found, skipping"; \
fi