Skip to content

Commit 3313555

Browse files
update makefile to use json config and add rpc dependency
1 parent 7a999a7 commit 3313555

2 files changed

Lines changed: 33 additions & 52 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/image.json

Makefile

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,62 @@
1-
__PHONY__: run logs build build-deps build-deps-core build-deps-horizon build-deps-friendbot build-deps-stellar-rpc
1+
__PHONY__: run logs console build build-deps build-deps-xdr build-deps-core build-deps-horizon build-deps-friendbot build-deps-rpc build-deps-lab
22

33
REVISION=$(shell git -c core.abbrev=no describe --always --exclude='*' --long --dirty)
4-
TAG?=dev
5-
PROTOCOL_VERSION_DEFAULT?=22
6-
XDR_REPO?=stellar/rs-stellar-xdr
7-
XDR_REF?=main
8-
CORE_REPO?=stellar/stellar-core
9-
CORE_REF?=master
10-
CORE_CONFIGURE_FLAGS?=--disable-tests
11-
STELLAR_RPC_REF?=main
12-
HORIZON_REF?=master
13-
FRIENDBOT_REF?=$(HORIZON_REF)
14-
LAB_REF?=main
4+
TAG?=latest
5+
6+
# Extract configuration from images.json
7+
PROTOCOL_VERSION_DEFAULT = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .config.protocol_version_default' images.json)
8+
XDR_REPO = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "xdr") | .repo' images.json)
9+
XDR_REF = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "xdr") | .ref' images.json)
10+
CORE_REPO = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "core") | .repo' images.json)
11+
CORE_REF = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "core") | .ref' images.json)
12+
CORE_OPTIONS = $(shell jq -c '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "core") | .options // {}' images.json)
13+
RPC_REPO = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "rpc") | .repo' images.json)
14+
RPC_REF = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "rpc") | .ref' images.json)
15+
HORIZON_REPO = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "horizon") | .repo' images.json)
16+
HORIZON_REF = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "horizon") | .ref' images.json)
17+
FRIENDBOT_REPO = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "friendbot") | .repo' images.json)
18+
FRIENDBOT_REF = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "friendbot") | .ref' images.json)
19+
LAB_REPO = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "lab") | .repo' images.json)
20+
LAB_REF = $(shell jq -r '.[] | select(.tag == "$(TAG)") | .deps[] | select(.name == "lab") | .ref' images.json)
1521

1622
run:
17-
docker run --rm --name stellar -p 8000:8000 stellar/quickstart:$(TAG) --local --enable-stellar-rpc
23+
docker run --rm --name stellar -p 8000:8000 stellar/quickstart:$(TAG) --local
1824

1925
logs:
2026
docker exec stellar /bin/sh -c 'tail -F /var/log/supervisor/*'
2127

2228
console:
2329
docker exec -it stellar /bin/bash
2430

25-
build-latest:
26-
$(MAKE) build TAG=latest \
27-
PROTOCOL_VERSION_DEFAULT=23 \
28-
XDR_REF=v23.0.0 \
29-
CORE_REF=v23.0.1 \
30-
HORIZON_REF=horizon-v23.0.0 \
31-
STELLAR_RPC_REF=v23.0.4 \
32-
FRIENDBOT_REF=horizon-v23.0.0
33-
34-
build-testing:
35-
$(MAKE) build TAG=testing \
36-
PROTOCOL_VERSION_DEFAULT=23 \
37-
XDR_REF=v23.0.0 \
38-
CORE_REF=v23.0.1 \
39-
HORIZON_REF=horizon-v23.0.0 \
40-
STELLAR_RPC_REF=v23.0.4 \
41-
FRIENDBOT_REF=horizon-v23.0.0
42-
43-
build-future:
44-
$(MAKE) build TAG=future \
45-
PROTOCOL_VERSION_DEFAULT=23 \
46-
XDR_REF=v23.0.0 \
47-
CORE_REF=v23.0.1 \
48-
HORIZON_REF=horizon-v23.0.0 \
49-
STELLAR_RPC_REF=v23.0.4 \
50-
FRIENDBOT_REF=horizon-v23.0.0
51-
5231
build:
53-
$(MAKE) -j 4 build-deps
32+
< images.json jq -c --arg tag '$(TAG)' '.[] | select(.tag == $$tag)' > image.json
33+
$(MAKE) build-deps
5434
docker build -t stellar/quickstart:$(TAG) -f Dockerfile . \
5535
--build-arg REVISION=$(REVISION) \
5636
--build-arg PROTOCOL_VERSION_DEFAULT=$(PROTOCOL_VERSION_DEFAULT) \
57-
--build-arg STELLAR_XDR_IMAGE_REF=stellar-xdr:$(XDR_REF) \
58-
--build-arg STELLAR_CORE_IMAGE_REF=stellar-core:$(CORE_REF) \
37+
--build-arg XDR_IMAGE_REF=stellar-xdr:$(XDR_REF) \
38+
--build-arg CORE_IMAGE_REF=stellar-core:$(CORE_REF) \
39+
--build-arg RPC_IMAGE_REF=stellar-rpc:$(RPC_REF) \
5940
--build-arg HORIZON_IMAGE_REF=stellar-horizon:$(HORIZON_REF) \
6041
--build-arg FRIENDBOT_IMAGE_REF=stellar-friendbot:$(FRIENDBOT_REF) \
61-
--build-arg STELLAR_RPC_IMAGE_REF=stellar-rpc:$(STELLAR_RPC_REF) \
6242
--build-arg LAB_IMAGE_REF=stellar-lab:$(LAB_REF)
6343

64-
build-deps: build-deps-xdr build-deps-core build-deps-horizon build-deps-friendbot build-deps-stellar-rpc build-deps-lab
44+
build-deps: build-deps-xdr build-deps-rpc build-deps-horizon build-deps-friendbot build-deps-lab build-deps-core
6545

6646
build-deps-xdr:
6747
docker build -t stellar-xdr:$(XDR_REF) -f Dockerfile.xdr . --build-arg REPO="$(XDR_REPO)" --build-arg REF="$(XDR_REF)"
6848

6949
build-deps-core:
70-
docker build -t stellar-core:$(CORE_REF) -f Dockerfile.core . --build-arg REPO="$(CORE_REPO)" --build-arg REF="$(CORE_REF)" --build-arg CONFIGURE_FLAGS="$(CORE_CONFIGURE_FLAGS)"
50+
docker build -t stellar-core:$(CORE_REF) -f Dockerfile.core . --build-arg REPO="$(CORE_REPO)" --build-arg REF="$(CORE_REF)" --build-arg OPTIONS='$(CORE_OPTIONS)'
51+
52+
build-deps-rpc:
53+
docker build -t stellar-rpc:$(RPC_REF) -f Dockerfile.rpc . --build-arg=REPO="$(RPC_REPO)" --build-arg REF="$(RPC_REF)"
7154

7255
build-deps-horizon:
73-
docker build -t stellar-horizon:$(HORIZON_REF) -f Dockerfile.horizon . --build-arg REF="$(HORIZON_REF)"
56+
docker build -t stellar-horizon:$(HORIZON_REF) -f Dockerfile.horizon . --build-arg REPO="$(HORIZON_REPO)" --build-arg REF="$(HORIZON_REF)"
7457

7558
build-deps-friendbot:
76-
docker build -t stellar-friendbot:$(FRIENDBOT_REF) -f Dockerfile.friendbot . --build-arg REF="$(FRIENDBOT_REF)"
77-
78-
build-deps-stellar-rpc:
79-
docker build -t stellar-rpc:$(STELLAR_RPC_REF) -f Dockerfile.rpc . --build-arg REF="$(STELLAR_RPC_REF)"
59+
docker build -t stellar-friendbot:$(FRIENDBOT_REF) -f Dockerfile.friendbot . --build-arg REPO="$(FRIENDBOT_REPO)" --build-arg REF="$(FRIENDBOT_REF)"
8060

8161
build-deps-lab:
82-
docker build -t stellar-lab:$(LAB_REF) -f Dockerfile.lab . --build-arg NEXT_PUBLIC_COMMIT_HASH=$(LAB_REF)
62+
docker build -t stellar-lab:$(LAB_REF) -f Dockerfile.lab . --build-arg REPO="$(LAB_REPO)" --build-arg NEXT_PUBLIC_COMMIT_HASH=$(LAB_REF)

0 commit comments

Comments
 (0)