From 9e0c2c0169fe7f260ea1e00d56be74e28f4fdf36 Mon Sep 17 00:00:00 2001 From: mwtzzz <101583293+mwtzzz@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:21:43 -0700 Subject: [PATCH] updates to horizon docker builds (#5466) --- services/horizon/docker/Dockerfile | 1 + .../horizon/docker/Dockerfile.core-testing | 19 ++++++++++++ services/horizon/docker/Dockerfile.stable | 18 ++++++++++++ services/horizon/docker/Makefile | 29 +++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 services/horizon/docker/Dockerfile.core-testing create mode 100644 services/horizon/docker/Dockerfile.stable diff --git a/services/horizon/docker/Dockerfile b/services/horizon/docker/Dockerfile index 3c090d203c..2d5c7a01a2 100644 --- a/services/horizon/docker/Dockerfile +++ b/services/horizon/docker/Dockerfile @@ -1,3 +1,4 @@ +# install Core from apt "stable" or "unstable" pool, and horizon from apt "testing" pool FROM ubuntu:focal ARG VERSION diff --git a/services/horizon/docker/Dockerfile.core-testing b/services/horizon/docker/Dockerfile.core-testing new file mode 100644 index 0000000000..c0d1dff8e6 --- /dev/null +++ b/services/horizon/docker/Dockerfile.core-testing @@ -0,0 +1,19 @@ +# install both horizon and core from apt "testing" 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 testing" | 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/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 51ee19f2fe..26d3c892d0 100644 --- a/services/horizon/docker/Makefile +++ b/services/horizon/docker/Makefile @@ -5,6 +5,7 @@ BUILD_DATE := $(shell date -u +%FT%TZ) TAG ?= stellar/stellar-horizon:$(VERSION) +# build with Core from apt "stable" or "unstable", and horizon from apt "testing" docker-build: ifndef VERSION $(error VERSION environment variable must be set. For example VERSION=2.4.1-101 ) @@ -22,6 +23,34 @@ else -t $(TAG) . endif +# build Core and Horizon from apt "testing" +docker-build-core-testing: +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) --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 --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) . +endif + docker-push: ifndef TAG $(error Must set VERSION or TAG environment variable. For example VERSION=2.4.1-101 )