-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (85 loc) · 2.63 KB
/
Copy pathMakefile
File metadata and controls
103 lines (85 loc) · 2.63 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Keycloak Nextcloud ExApp - Build System
REGISTRY ?= ghcr.io/conductionnl
IMAGE_NAME ?= keycloak-nextcloud
VERSION ?= 1.0.0
.PHONY: build push run test clean help lint format mypy check check-full check-strict
help:
@echo "Keycloak Nextcloud ExApp"
@echo ""
@echo "Usage:"
@echo " make build - Build Docker image"
@echo " make push - Push to registry"
@echo " make run - Run locally for testing"
@echo " make test - Test endpoints"
@echo " make clean - Remove local images"
@echo ""
@echo "Variables:"
@echo " REGISTRY=$(REGISTRY)"
@echo " VERSION=$(VERSION)"
build:
docker build -t $(REGISTRY)/$(IMAGE_NAME):$(VERSION) -t $(REGISTRY)/$(IMAGE_NAME):latest .
push: build
docker push $(REGISTRY)/$(IMAGE_NAME):$(VERSION)
docker push $(REGISTRY)/$(IMAGE_NAME):latest
run:
docker run -it --rm \
-e APP_ID=keycloak \
-e APP_SECRET=dev-secret \
-e APP_HOST=0.0.0.0 \
-e APP_PORT=23000 \
-e APP_PERSISTENT_STORAGE=/data \
-e NEXTCLOUD_URL=http://host.docker.internal:8080 \
-e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
-e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
-p 23000:23000 \
-p 8081:8080 \
$(REGISTRY)/$(IMAGE_NAME):latest
test:
@echo "Testing heartbeat endpoint..."
@curl -s http://localhost:23000/heartbeat || echo "Container not running"
@echo ""
@echo "Testing Keycloak health..."
@curl -s http://localhost:9000/health/ready || echo "Keycloak not running"
clean:
-docker rmi $(REGISTRY)/$(IMAGE_NAME):$(VERSION)
-docker rmi $(REGISTRY)/$(IMAGE_NAME):latest
# ── Code Quality ───────────────────────────────────────────────────────
lint:
ruff check ex_app/
format:
ruff format --check ex_app/
format-fix:
ruff format ex_app/
lint-fix:
ruff check --fix ex_app/
mypy:
mypy ex_app/
test-unit:
pytest tests/ || echo "Tests require dependencies, skipping..."
check:
@E=0; \
for CMD in lint mypy; do \
echo; echo "=== $$CMD ==="; \
$(MAKE) $$CMD || E=1; \
done; \
echo; \
if [ $$E -eq 0 ]; then echo "ALL CHECKS PASSED"; else echo "SOME CHECKS FAILED (see above)"; fi; \
exit $$E
check-full:
@E=0; \
for CMD in lint format mypy test-unit; do \
echo; echo "=== $$CMD ==="; \
$(MAKE) $$CMD || E=1; \
done; \
echo; \
if [ $$E -eq 0 ]; then echo "ALL CHECKS PASSED"; else echo "SOME CHECKS FAILED (see above)"; fi; \
exit $$E
check-strict:
@E=0; \
for CMD in lint format mypy test-unit; do \
echo; echo "=== $$CMD ==="; \
$(MAKE) $$CMD || E=1; \
done; \
echo; \
if [ $$E -eq 0 ]; then echo "ALL CHECKS PASSED"; else echo "SOME CHECKS FAILED (see above)"; fi; \
exit $$E