Skip to content

Commit 93f017b

Browse files
first commit
0 parents  commit 93f017b

File tree

13 files changed

+832
-0
lines changed

13 files changed

+832
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build & publish Namada image
2+
3+
#—————————————————————————————————————————
4+
# 1. Run ONLY when we push a tag ‘v<node>-<imgRev>’ (e.g. v1.1.0-1beta)
5+
#—————————————————————————————————————————
6+
on:
7+
push:
8+
tags: [ 'v*-*' ] # any vX.Y.Z-whatever
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }} # ghcr.io/<owner>/<repo>
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read # checkout
19+
packages: write # push to GHCR
20+
21+
steps:
22+
# ————————————————————————————————————————
23+
# 2. Grab the code
24+
# ————————————————————————————————————————
25+
- name: Checkout repo
26+
uses: actions/checkout@v4
27+
28+
29+
# ————————————————————————————————————————
30+
# 3. Work out the two versions from the tag
31+
# tag=v1.1.0-1beta → node=1.1.0 imgRev=1beta
32+
# ————————————————————————————————————————
33+
- name: Parse tag parts
34+
id: versions
35+
run: |
36+
TAG="${GITHUB_REF#refs/tags/}" # e.g. v1.1.0-1beta
37+
NODE_VERSION="${TAG%%-*}" # v1.1.0
38+
IMAGE_REV="${TAG#*-}" # 1beta
39+
echo "NODE_VERSION=$NODE_VERSION" >> "$GITHUB_OUTPUT"
40+
echo "IMAGE_REV=$IMAGE_REV" >> "$GITHUB_OUTPUT"
41+
echo "GIT_TAG=$TAG" >> "$GITHUB_OUTPUT"
42+
43+
# ————————————————————————————————————————
44+
# 4. Log in to the container registry
45+
# ————————————————————————————————————————
46+
- name: Log in to GHCR
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
- uses: docker/setup-buildx-action@v3
53+
54+
# ————————————————————————————————————————
55+
# 5. Create the image tag list (just the Git tag)
56+
# ————————————————————————————————————————
57+
- name: Generate Docker tags
58+
id: meta
59+
uses: docker/metadata-action@v5
60+
with:
61+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
62+
tags: |
63+
type=raw,value=${{ steps.versions.outputs.GIT_TAG }}
64+
visibility: public
65+
66+
# ————————————————————————————————————————
67+
# 6. Build & push
68+
# ————————————————————————————————————————
69+
- name: Build and push
70+
uses: docker/build-push-action@v5
71+
with:
72+
context: .
73+
push: true
74+
platforms: linux/amd64 # add ,linux/arm64 if you need multi‑arch
75+
tags: ${{ steps.meta.outputs.tags }}
76+
labels: ${{ steps.meta.outputs.labels }}
77+
build-args: |
78+
NAMADA_VERSION=${{ steps.versions.outputs.NODE_VERSION }}
79+
cache-from: type=gha,scope=${{ github.ref_name }}
80+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dev_sync.sh

Dockerfile

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
FROM lukemathwalker/cargo-chef:latest-rust-1.85.1-bookworm AS chef
2+
3+
WORKDIR /src
4+
5+
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
build-essential \
7+
clang-tools-14 \
8+
git \
9+
libssl-dev \
10+
pkg-config \
11+
protobuf-compiler \
12+
libudev-dev \
13+
libprotobuf-dev \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
# ------ SOURCES STAGE --------------------------
17+
FROM chef AS source
18+
ARG NAMADA_VERSION=main
19+
20+
RUN git clone --depth 1 --branch ${NAMADA_VERSION} https://github.com/namada-net/namada.git .
21+
22+
# --------------------------PLANNER STAGE--------------------------
23+
24+
FROM chef AS planner
25+
WORKDIR /src
26+
27+
COPY --from=source /src/ .
28+
29+
RUN cargo chef prepare --recipe-path recipe.json
30+
# --------------------------DEPS STAGE--------------------------
31+
FROM chef AS deps
32+
33+
COPY --from=planner /src/recipe.json recipe.json
34+
RUN cargo chef cook --release --recipe-path recipe.json
35+
36+
# -------------------------- BUILDER STAGE--------------------------
37+
38+
FROM chef AS builder
39+
COPY --from=source /src/ /src
40+
# re-use deps
41+
COPY --from=deps /src/target /src/target
42+
COPY --from=deps /usr/local/cargo /usr/local/cargo
43+
# build application
44+
RUN make build-release JOBS=$(nproc)
45+
46+
FROM golang:1.21.0 AS tendermint-builder
47+
WORKDIR /app
48+
49+
RUN git clone -b v0.37.15 --single-branch https://github.com/cometbft/cometbft.git && cd cometbft && make build
50+
51+
FROM debian:bookworm-slim AS runtime
52+
53+
ENV NAMADA_LOG_COLOR=false
54+
55+
RUN apt-get update && \
56+
apt-get install -y --no-install-recommends \
57+
libcurl4-openssl-dev \
58+
curl \
59+
jq \
60+
lz4 \
61+
libudev-dev \
62+
ca-certificates \
63+
gosu \
64+
python3 python3-pip python3-venv pipx \
65+
&& rm -rf /var/lib/apt/lists/*
66+
67+
68+
69+
RUN useradd -m --uid 1000 --user-group namada
70+
ENV PIPX_BIN_DIR=/usr/local/bin
71+
72+
RUN pipx install --pip-args="--no-cache-dir" "ansible-core==2.18.6"
73+
74+
RUN ansible --version
75+
RUN ansible-galaxy collection install community.general
76+
77+
COPY --from=builder /src/target/release/namada /usr/local/bin/
78+
COPY --from=builder /src/target/release/namadan /usr/local/bin/
79+
COPY --from=builder /src/target/release/namadaw /usr/local/bin/
80+
COPY --from=builder /src/target/release/namadac /usr/local/bin/
81+
COPY --from=tendermint-builder --chmod=0755 /app/cometbft/build/cometbft /usr/local/bin
82+
83+
COPY entrypoint.sh /usr/local/bin/
84+
RUN chmod +x /usr/local/bin/entrypoint.sh
85+
86+
COPY ansible/ /ansible/
87+
88+
EXPOSE 26656 26657 26659 26660 26658
89+
90+
RUN mkdir -p /home/namada/.local/share/namada
91+
92+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

0 commit comments

Comments
 (0)