diff --git a/cmd/soroban-rpc/docker/Dockerfile b/cmd/soroban-rpc/docker/Dockerfile index cbe03a87..a9608256 100644 --- a/cmd/soroban-rpc/docker/Dockerfile +++ b/cmd/soroban-rpc/docker/Dockerfile @@ -1,6 +1,7 @@ FROM golang:1.22-bullseye as build ARG RUST_TOOLCHAIN_VERSION=stable ARG REPOSITORY_VERSION +ARG BINARY_NAME=soroban-rpc WORKDIR /go/src/github.com/stellar/soroban-rpc @@ -18,11 +19,14 @@ RUN apt-get clean RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUST_TOOLCHAIN_VERSION -RUN make REPOSITORY_VERSION=${REPOSITORY_VERSION} build-soroban-rpc -RUN mv soroban-rpc /bin/soroban-rpc +RUN make REPOSITORY_VERSION=${REPOSITORY_VERSION} build-${BINARY_NAME} + +# Move the binary to a common location +RUN mv ${BINARY_NAME} /bin/${BINARY_NAME} FROM ubuntu:22.04 ARG STELLAR_CORE_VERSION +ARG BINARY_NAME=soroban-rpc ENV STELLAR_CORE_VERSION=${STELLAR_CORE_VERSION:-*} ENV STELLAR_CORE_BINARY_PATH /usr/bin/stellar-core ENV DEBIAN_FRONTEND=noninteractive @@ -35,5 +39,8 @@ RUN echo "deb https://apt.stellar.org focal unstable" >/etc/apt/sources.list.d/S RUN apt-get update && apt-get install -y stellar-core=${STELLAR_CORE_VERSION} RUN apt-get clean -COPY --from=build /bin/soroban-rpc /app/ -ENTRYPOINT ["/app/soroban-rpc"] +# Copy the binary from the build stage +COPY --from=build /bin/${BINARY_NAME} /app/${BINARY_NAME} + +# Set the entrypoint to the specific binary +ENTRYPOINT ["/app/${BINARY_NAME}"] \ No newline at end of file diff --git a/cmd/soroban-rpc/docker/Makefile b/cmd/soroban-rpc/docker/Makefile index f3f39994..1d02a5cd 100644 --- a/cmd/soroban-rpc/docker/Makefile +++ b/cmd/soroban-rpc/docker/Makefile @@ -22,12 +22,22 @@ ifndef STELLAR_CORE_VERSION $(error STELLAR_CORE_VERSION environment variable must be set. For example 19.10.1-1310.6649f5173.focal~soroban) endif -TAG ?= stellar/stellar-soroban-rpc:$(SOROBAN_RPC_VERSION_PACKAGE_VERSION) +# Set default value for BINARY_NAME if not provided +BINARY_NAME ?= soroban-rpc + +# Set the TAG based on the value of BINARY_NAME +ifeq ($(BINARY_NAME),stellar-rpc) + TAG := stellar/stellar-rpc:$(SOROBAN_RPC_VERSION_PACKAGE_VERSION) +else + TAG := stellar/stellar-soroban-rpc:$(SOROBAN_RPC_VERSION_PACKAGE_VERSION) +endif + docker-build: $(SUDO) docker build --pull --platform linux/amd64 $(DOCKER_OPTS) \ --label org.opencontainers.image.created="$(BUILD_DATE)" \ --build-arg STELLAR_CORE_VERSION=$(STELLAR_CORE_VERSION) --build-arg SOROBAN_RPC_VERSION=$(SOROBAN_RPC_VERSION_PACKAGE_VERSION) \ + --build-arg BINARY_NAME=$(BINARY_NAME) \ -t $(TAG) -f Dockerfile.release . docker-push: