Skip to content

Commit

Permalink
allow CORE_IMAGE bin override (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland authored Jun 18, 2024
1 parent a10c468 commit 278bdfa
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
11 changes: 11 additions & 0 deletions Dockerfile.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG CORE_IMAGE=

FROM $CORE_IMAGE as stellar-core

FROM ubuntu
ARG CORE_IMAGE_BIN_PATH=

COPY --from=stellar-core ${CORE_IMAGE_BIN_PATH} /usr/local/bin/stellar-core



12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ FRIENDBOT_IMAGE=
# image must have the bin at /usr/local/cargo/bin/stellar-xdr
RS_XDR_IMAGE=
#
# image must have core bin at /usr/local/bin/stellar-core
# image with stellar-core binary, assumes core bin at /usr/local/bin/stellar-core
CORE_IMAGE=
# define a custom path that core bin is located on CORE_IMAGE, other than /usr/local/bin/stellar-core
CORE_IMAGE_BIN_PATH=
#
# a prebuilt 'soroban-dev' image from the quickstart repo, if this is supplied,
# the other core, rpc, horizon, friendbot config settings are mostly ignored, since the quickstart image
Expand Down Expand Up @@ -146,11 +148,17 @@ build-core:
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \
--build-arg CONFIGURE_FLAGS="$(CORE_COMPILE_CONFIGURE_FLAGS)" \
-f docker/Dockerfile.testing "$$SOURCE_URL"; \
fi; \
if [ ! -z "$(CORE_IMAGE)" ] && [ ! -z "$(CORE_IMAGE_BIN_PATH)" ]; then \
docker build -t "$(CORE_STAGE_IMAGE)" \
--build-arg CORE_IMAGE="$(CORE_IMAGE)" \
--build-arg CORE_IMAGE_BIN_PATH="$(CORE_IMAGE_BIN_PATH)" \
-f Dockerfile.core .; \
fi

build-quickstart: build-core build-friendbot build-horizon build-rs-xdr build-soroban-rpc
if [ -z "$(QUICKSTART_IMAGE)" ]; then \
CORE_IMAGE_REF=$$( [ -z "$(CORE_IMAGE)" ] && echo "$(CORE_STAGE_IMAGE)" || echo "$(CORE_IMAGE)"); \
CORE_IMAGE_REF=$$( [[ -z "$(CORE_IMAGE)" || ! -z "$(CORE_IMAGE_BIN_PATH)" ]] && echo "$(CORE_STAGE_IMAGE)" || echo "$(CORE_IMAGE)"); \
HORIZON_IMAGE_REF=$$( [ -z "$(HORIZON_IMAGE)" ] && echo "$(HORIZON_STAGE_IMAGE)" || echo "$(HORIZON_IMAGE)"); \
FRIENDBOT_IMAGE_REF=$$( [ -z "$(FRIENDBOT_IMAGE)" ] && echo "$(FRIENDBOT_STAGE_IMAGE)" || echo "$(FRIENDBOT_IMAGE)"); \
SOROBAN_RPC_IMAGE_REF=$$( [ -z "$(SOROBAN_RPC_IMAGE)" ] && echo "$(SOROBAN_RPC_STAGE_IMAGE)" || echo "$(SOROBAN_RPC_IMAGE)"); \
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@
QUICKSTART_IMAGE=<docker registry>/<docker image name>:<docker tag>
# this will skip building core from CORE_GIT_REF and instead
# will use the bin already compiled at /usr/local/bin/stellar-core in the existing docker image provided:
# will use the `stellar-core` by default at /usr/local/bin/stellar-core in the existing docker image provided:
CORE_IMAGE=<docker registry>/<docker image name>:<docker tag>
# define a custom path that `stellar-core` bin is located on CORE_IMAGE,
# to override the default of /usr/local/bin/stellar-core
CORE_IMAGE_BIN_PATH=
# this will skip building soroban-rpc from SOROBAN_RPC_GIT_REF and instead
# will use the bin already compiled at /bin/soroban-rpc in the existing docker image provided:
SOROBAN_RPC_IMAGE=<docker registry>/<docker image name>:<docker tag>
Expand Down

0 comments on commit 278bdfa

Please sign in to comment.