From 8272ff0eae0eb54a13d4145b65dbf466dcfa7ace Mon Sep 17 00:00:00 2001 From: Silberengel Date: Sat, 11 Apr 2026 08:39:47 +0200 Subject: [PATCH] update setup script and Dockerfile --- docker/server.Dockerfile | 9 +++++++-- setup.sh | 41 ++++++++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/docker/server.Dockerfile b/docker/server.Dockerfile index 24d2d31..b715f98 100644 --- a/docker/server.Dockerfile +++ b/docker/server.Dockerfile @@ -58,10 +58,15 @@ COPY config/runtime.exs config/ COPY rel rel RUN mix release -# Lean runtime stage +# Lean runtime stage (NIFs ship compiled libs; lib_secp256k1 links libsecp256k1 statically in the builder). FROM ${RUNNER_IMAGE} RUN apt-get update && \ - apt-get install -y libstdc++6 openssl libncurses6 locales && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + libstdc++6 \ + libncurses6 \ + locales \ + openssl && \ apt-get clean && \ rm -f /var/lib/apt/lists/*_* diff --git a/setup.sh b/setup.sh index b234c15..8b3fa53 100755 --- a/setup.sh +++ b/setup.sh @@ -1,10 +1,11 @@ #!/usr/bin/env bash -# Local development setup for gc_index_relay. +# Local development setup for gc_index_relay (run on your host — NOT inside app Docker images). +# Production/runtime images get dependencies from docker/server.Dockerfile (release build + runtime packages). # Safe to run multiple times — all steps are idempotent. # # Requirements: # - Docker must already be installed (https://docs.docker.com/engine/install/) -# - sudo access for apt-get +# - sudo access to install OS packages (apt-get on Debian/Ubuntu, dnf/yum on Fedora/RHEL) # # Usage: # chmod +x setup.sh @@ -62,10 +63,10 @@ docker info &>/dev/null || err "Docker daemon is not running. Start it and try a log "Docker: $(docker --version)" # --------------------------------------------------------------------------- -# 2. System build dependencies (Debian/Ubuntu/Mint) +# 2. System build dependencies (Debian/Ubuntu, Fedora, RHEL-like) # --------------------------------------------------------------------------- -if command -v apt-get &>/dev/null; then +install_system_deps_apt() { log "Installing system build dependencies via apt-get..." sudo apt-get update -qq sudo apt-get install -y \ @@ -76,9 +77,37 @@ if command -v apt-get &>/dev/null; then git \ curl \ jq +} + +# Fedora / RHEL / Alma / Rocky (dnf or yum). Includes openssl/ncurses headers for asdf Erlang builds. +install_system_deps_rpm() { + local pm="$1" + log "Installing system build dependencies via $pm..." + sudo "$pm" install -y \ + gcc \ + gcc-c++ \ + make \ + autoconf \ + automake \ + libtool \ + inotify-tools \ + git \ + curl \ + jq \ + openssl-devel \ + ncurses-devel +} + +if command -v apt-get &>/dev/null; then + install_system_deps_apt +elif command -v dnf &>/dev/null; then + install_system_deps_rpm dnf +elif command -v yum &>/dev/null; then + install_system_deps_rpm yum else - warn "apt-get not found — skipping system package install." - warn "Make sure these are installed manually: build-essential autoconf libtool inotify-tools git curl" + warn "No supported package manager found (apt-get, dnf, or yum) — skipping system package install." + warn "Install manually (names differ by distro): C toolchain, autoconf, libtool, inotify-tools, git, curl, jq" + warn "For asdf Erlang on Fedora/RHEL, you typically also need: openssl-devel, ncurses-devel" fi # ---------------------------------------------------------------------------