Browse Source

update setup script and Dockerfile

test/local-setup
Silberengel 3 weeks ago
parent
commit
8272ff0eae
  1. 9
      docker/server.Dockerfile
  2. 41
      setup.sh

9
docker/server.Dockerfile

@ -58,10 +58,15 @@ COPY config/runtime.exs config/ @@ -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/*_*

41
setup.sh

@ -1,10 +1,11 @@ @@ -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 @@ -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 @@ -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
# ---------------------------------------------------------------------------

Loading…
Cancel
Save