-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (48 loc) · 1.36 KB
/
Makefile
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
TEST_DIR=${PWD}/test
DEFAULT_POSTGRES_DB=ghostfolio-db
DEFAULT_POSTGRES_USER=ghostfolio
define wait_for_container
@timeout=60; \
while ! $1; do \
sleep 5; \
timeout=$$((timeout - 5)); \
if [ $$timeout -le 0 ]; then \
echo "Timed out waiting for container to start"; \
exit 1; \
fi; \
done
endef
define docker-build
docker buildx build --pull \
--build-arg ANSIBLE_CORE_TAG=$(1) \
--platform $(2) \
-t ghostfolio-installer .
endef
build:
$(call docker-build,"2.15-alpine-3.18","linux/amd64")
build-arm:
$(call docker-build,"alpine","linux/arm64")
run: build
docker run --rm\
-v ${TEST_DIR}:/ghostfolio \
-v /var/run/docker.sock:/var/run/docker.sock \
ghostfolio-installer
run-with-params: build
docker run --rm \
-e POSTGRES_PORT=5433 \
-e REDIS_PW="OVERRIDE" \
-e POSTGRES_DB=my-db \
-e POSTGRES_USER=myuser \
-e POSTGRES_PW=mypwforghostfolio \
-e ACCESS_TOKEN_SALT=accessTokenSaltOverride \
-e JWT_SECRET=jwtOverride \
-v ${TEST_DIR}:/ghostfolio \
-v /var/run/docker.sock:/var/run/docker.sock \
ghostfolio-installer
test: run
@echo "wait for redis to be healthy..."
$(call wait_for_container, docker exec redis-ghostfolio redis-cli ping | grep PONG > /dev/null)
@echo "wait for postgres to be healthy..."
@wait-for-it localhost:5432 -t 60
@echo "wait for ghostfolio to be healthy..."
@wait-for-it localhost:3333 -t 60