From 844f84702301b680e9f054c091e0923c37d281c9 Mon Sep 17 00:00:00 2001 From: michaelmartinez Date: Tue, 24 Sep 2024 12:07:57 -0700 Subject: [PATCH] add support to build horizon docker images from apt stable ### What build horizon docker image from core "stable" and horizon "stable" ### Why this is needed in order to support the new workflow described in the ticket ### Testing this has been tested and works with apt "testing" ### Issue addressed by this PR https://github.com/stellar/ops/issues/3124 --- services/horizon/docker/Dockerfile.stable | 18 ++++++++++++++++++ services/horizon/docker/Makefile | 16 ++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 services/horizon/docker/Dockerfile.stable diff --git a/services/horizon/docker/Dockerfile.stable b/services/horizon/docker/Dockerfile.stable new file mode 100644 index 0000000000..63f268873a --- /dev/null +++ b/services/horizon/docker/Dockerfile.stable @@ -0,0 +1,18 @@ +# install Core from apt "stable"and horizon from apt "stable" pool +FROM ubuntu:focal + +ARG VERSION +ARG STELLAR_CORE_VERSION +ARG DEBIAN_FRONTEND=noninteractive +ARG ALLOW_CORE_UNSTABLE=no + +RUN apt-get update && apt-get install -y wget apt-transport-https gnupg2 && \ + wget -qO /etc/apt/trusted.gpg.d/SDF.asc https://apt.stellar.org/SDF.asc && \ + echo "deb https://apt.stellar.org focal stable" | tee -a /etc/apt/sources.list.d/SDF.list && \ + cat /etc/apt/sources.list.d/SDF.list && \ + apt-get update && apt-cache madison stellar-core && eval "apt-get install -y stellar-core${STELLAR_CORE_VERSION+=$STELLAR_CORE_VERSION}" && \ + apt-cache madison stellar-horizon && apt-get install -y stellar-horizon=${VERSION} && \ + apt-get clean && rm -rf /var/lib/apt/lists/* /var/log/*.log /var/log/*/*.log + +EXPOSE 8000 +ENTRYPOINT ["/usr/bin/stellar-horizon"] diff --git a/services/horizon/docker/Makefile b/services/horizon/docker/Makefile index 16f6e2f831..26d3c892d0 100644 --- a/services/horizon/docker/Makefile +++ b/services/horizon/docker/Makefile @@ -29,11 +29,23 @@ ifndef VERSION $(error VERSION environment variable must be set. For example VERSION=2.4.1-101 ) endif ifndef STELLAR_CORE_VERSION + $(error STELLAR_CORE_VERSION environment variable must be set. ) +else $(SUDO) docker build --file ./Dockerfile.core-testing --pull $(DOCKER_OPTS) \ --label org.opencontainers.image.created="$(BUILD_DATE)" \ - --build-arg VERSION=$(VERSION) -t $(TAG) . + --build-arg VERSION=$(VERSION) --build-arg STELLAR_CORE_VERSION=$(STELLAR_CORE_VERSION) \ + -t $(TAG) . +endif + +# build Core and Horizon from apt "stable" +docker-build-core-stable: +ifndef VERSION + $(error VERSION environment variable must be set. For example VERSION=2.4.1-101 ) +endif +ifndef STELLAR_CORE_VERSION + $(error STELLAR_CORE_VERSION environment variable must be set. ) else - $(SUDO) docker build --pull $(DOCKER_OPTS) \ + $(SUDO) docker build --file ./Dockerfile.stable --pull $(DOCKER_OPTS) \ --label org.opencontainers.image.created="$(BUILD_DATE)" \ --build-arg VERSION=$(VERSION) --build-arg STELLAR_CORE_VERSION=$(STELLAR_CORE_VERSION) \ -t $(TAG) .