Skip to content

Commit 67f1939

Browse files
committed
feat: Add Docker Hub deployment support
- Added GitHub Actions workflow for automated Docker Hub builds - Created multi-architecture Dockerfile.hub for Docker Hub - Updated README with Docker Hub deployment options (Option 1 - Recommended) - Enhanced setup.sh to automatically choose Docker Hub vs local build - Added comprehensive Docker Hub setup guide - Multi-platform support (linux/amd64, linux/arm64) - Automated builds on push to main and version tags Docker Hub image: meta-flora/flora-chain-testnet-peer:latest
1 parent 5a8c528 commit 67f1939

5 files changed

Lines changed: 329 additions & 12 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
env:
11+
REGISTRY: docker.io
12+
IMAGE_NAME: meta-flora/flora-chain-testnet-peer
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to Docker Hub
29+
if: github.event_name != 'pull_request'
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ secrets.DOCKER_USERNAME }}
34+
password: ${{ secrets.DOCKER_TOKEN }}
35+
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=ref,event=branch
43+
type=ref,event=pr
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=raw,value=latest,enable={{is_default_branch}}
47+
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: .
52+
platforms: linux/amd64,linux/arm64
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max

β€ŽDOCKER_HUB_SETUP.mdβ€Ž

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Docker Hub Deployment Guide
2+
3+
This guide explains how to set up automated Docker Hub builds for the Flora Chain peer node.
4+
5+
## Prerequisites
6+
7+
1. Docker Hub account
8+
2. GitHub repository with admin access
9+
3. Docker Hub repository created
10+
11+
## Setup Steps
12+
13+
### 1. Create Docker Hub Repository
14+
15+
1. Go to [Docker Hub](https://hub.docker.com)
16+
2. Click "Create Repository"
17+
3. Repository name: `flora-chain-testnet-peer`
18+
4. Description: `Production-ready Flora Chain peer node for testnet`
19+
5. Visibility: Public
20+
6. Click "Create"
21+
22+
### 2. Configure GitHub Secrets
23+
24+
Add these secrets to your GitHub repository:
25+
26+
1. Go to GitHub repository β†’ Settings β†’ Secrets and variables β†’ Actions
27+
2. Add the following secrets:
28+
29+
| Secret Name | Value | Description |
30+
|-------------|-------|-------------|
31+
| `DOCKER_USERNAME` | Your Docker Hub username | Docker Hub login username |
32+
| `DOCKER_TOKEN` | Your Docker Hub access token | Docker Hub access token (not password) |
33+
34+
### 3. Create Docker Hub Access Token
35+
36+
1. Go to Docker Hub β†’ Account Settings β†’ Security
37+
2. Click "New Access Token"
38+
3. Token description: `GitHub Actions - flora-chain-testnet-peer`
39+
4. Access permissions: Read, Write, Delete
40+
5. Copy the token and add it to GitHub secrets as `DOCKER_TOKEN`
41+
42+
### 4. Update Image Name (if needed)
43+
44+
If your Docker Hub username/organization is different from `meta-flora`, update the image name in:
45+
46+
- `.github/workflows/docker-build.yml` (line 8: `IMAGE_NAME`)
47+
- `README.md` (all references to `meta-flora/flora-chain-testnet-peer`)
48+
- `setup.sh` (line 36: Docker run command)
49+
50+
### 5. Test the Build
51+
52+
1. Push a commit to trigger the GitHub Action
53+
2. Check the Actions tab in GitHub
54+
3. Verify the build completes successfully
55+
4. Check Docker Hub for the new image
56+
57+
## Build Triggers
58+
59+
The GitHub Action will automatically build and push images when:
60+
61+
- **Push to main branch**: Creates `latest` and `main` tags
62+
- **Create a tag**: Creates version tags (e.g., `v1.0.0`)
63+
- **Pull requests**: Builds but doesn't push (for testing)
64+
65+
## Manual Build
66+
67+
To manually build and push:
68+
69+
```bash
70+
# Build for multiple architectures
71+
docker buildx build --platform linux/amd64,linux/arm64 \
72+
-t meta-flora/flora-chain-testnet-peer:latest \
73+
--push .
74+
75+
# Build for specific architecture
76+
docker buildx build --platform linux/amd64 \
77+
-t meta-flora/flora-chain-testnet-peer:latest \
78+
--push .
79+
```
80+
81+
## Verification
82+
83+
After the build completes:
84+
85+
1. **Check Docker Hub**: Verify the image appears in your repository
86+
2. **Test locally**: Pull and run the image
87+
3. **Check platforms**: Ensure multi-architecture support works
88+
89+
```bash
90+
# Test the Docker Hub image
91+
docker run -d --name test-flora-peer \
92+
-p 26656:26656 -p 26657:26657 -p 1317:1317 -p 9090:9090 \
93+
meta-flora/flora-chain-testnet-peer:latest
94+
95+
# Check if it's running
96+
docker ps | grep test-flora-peer
97+
98+
# Check logs
99+
docker logs test-flora-peer
100+
101+
# Clean up
102+
docker stop test-flora-peer && docker rm test-flora-peer
103+
```
104+
105+
## Troubleshooting
106+
107+
### Build Failures
108+
109+
- Check GitHub Actions logs for specific errors
110+
- Verify Docker Hub credentials are correct
111+
- Ensure the Docker Hub repository exists and is accessible
112+
113+
### Image Not Available
114+
115+
- Wait a few minutes for Docker Hub to process the image
116+
- Check if the image was pushed to the correct repository
117+
- Verify the image name matches your Docker Hub username/organization
118+
119+
### Multi-architecture Issues
120+
121+
- Ensure Docker Buildx is available in the GitHub runner
122+
- Check that all target platforms are supported
123+
- Verify the base image supports multi-architecture builds
124+
125+
## Maintenance
126+
127+
- **Regular Updates**: Push changes to trigger new builds
128+
- **Version Tags**: Create Git tags for releases (e.g., `v1.0.0`)
129+
- **Security**: Regularly update base images and dependencies
130+
- **Monitoring**: Monitor Docker Hub repository for usage and issues

β€ŽDockerfile.hubβ€Ž

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Flora Chain Peer Node - Docker Hub Optimized
2+
# Multi-architecture support for Docker Hub
3+
4+
ARG TARGETPLATFORM
5+
ARG BUILDPLATFORM
6+
7+
FROM --platform=$TARGETPLATFORM ubuntu:22.04
8+
9+
# Set environment variables
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
ENV FLORA_HOME=/root/.florachain
12+
ENV MONIKER=flora-peer-docker
13+
14+
# Network Configuration
15+
ENV CHAIN_ID="flora-1"
16+
ENV MAIN_NODE_ID="0fdd195eba262dbb1cf1e33f85ff5990722d93c6"
17+
ENV MAIN_NODE_ADDRESS="testnet-gateway.metaflora.xyz:26656"
18+
ENV RPC_ENDPOINT="https://testnet-gateway.metaflora.xyz:26657"
19+
ENV GRPC_ENDPOINT="https://testnet-gateway.metaflora.xyz:9090"
20+
21+
# Download URLs (official gateway)
22+
ENV BINARY_URL="https://testnet-gateway.metaflora.xyz/downloads/florachaind-v2"
23+
ENV GENESIS_URL="https://testnet-gateway.metaflora.xyz/downloads/genesis.json"
24+
ENV CHECKSUM_URL="https://testnet-gateway.metaflora.xyz/downloads/florachaind-v2.sha256"
25+
26+
# Install dependencies including build tools and compatibility libraries
27+
RUN apt-get update && apt-get install -y \
28+
build-essential \
29+
git \
30+
curl \
31+
jq \
32+
ca-certificates \
33+
wget \
34+
libc6-dev \
35+
libgcc-s1 \
36+
libstdc++6 \
37+
file \
38+
libc6 \
39+
&& rm -rf /var/lib/apt/lists/* && \
40+
# Download CosmWasm library matching the binary's version (v2.2.4)
41+
curl -L "https://github.com/CosmWasm/wasmvm/releases/download/v2.2.4/libwasmvm.x86_64.so" -o /lib/libwasmvm.x86_64.so && \
42+
chmod +x /lib/libwasmvm.x86_64.so
43+
44+
# Copy the peer script
45+
COPY simple-flora-peer.sh /usr/local/bin/simple-flora-peer.sh
46+
RUN chmod +x /usr/local/bin/simple-flora-peer.sh
47+
48+
# Pre-download and install the binary
49+
RUN curl -s --connect-timeout 60 "https://testnet-gateway.metaflora.xyz/downloads/florachaind-v2" -o /usr/local/bin/florachaind && \
50+
chmod +x /usr/local/bin/florachaind
51+
52+
# Expose ports
53+
EXPOSE 26656 26657 9090 1317
54+
55+
# Set volume for data persistence
56+
VOLUME ["/root/.florachain"]
57+
58+
# Health check
59+
HEALTHCHECK --interval=30s --timeout=10s --start-period=300s --retries=3 \
60+
CMD curl -f http://localhost:26657/status || exit 1
61+
62+
# Start the peer node
63+
CMD ["/usr/local/bin/simple-flora-peer.sh"]

β€ŽREADME.mdβ€Ž

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ A production-ready Docker setup for running a Flora Chain peer node on the testn
44

55
## πŸš€ Quick Start
66

7+
### Option 1: Docker Hub (Recommended - No Build Required)
8+
9+
```bash
10+
# Pull and run the pre-built image from Docker Hub
11+
docker run -d --name flora-peer \
12+
-p 26656:26656 -p 26657:26657 -p 1317:1317 -p 9090:9090 \
13+
meta-flora/flora-chain-testnet-peer:latest
14+
15+
# Check node status
16+
curl http://localhost:26657/status | jq -r '.result.node_info.moniker, .result.sync_info.latest_block_height'
17+
```
18+
19+
### Option 2: Docker Compose
20+
721
```bash
822
# Clone the repository
923
git clone https://github.com/meta-flora/testnet-node.git
@@ -16,12 +30,46 @@ docker-compose up -d
1630
curl http://localhost:26657/status | jq -r '.result.node_info.moniker, .result.sync_info.latest_block_height'
1731
```
1832

33+
### Option 3: One-liner Script
34+
35+
```bash
36+
# Run directly with curl (uses Docker Hub image)
37+
curl -sSL https://raw.githubusercontent.com/meta-flora/testnet-node/main/setup.sh | bash
38+
```
39+
1940
## πŸ“‹ Prerequisites
2041

2142
- Docker and Docker Compose installed
2243
- At least 4GB RAM available
2344
- Ports 26656, 26657, 9090, and 1317 available
2445

46+
## 🐳 Docker Hub
47+
48+
The pre-built image is available on Docker Hub:
49+
50+
- **Image**: `meta-flora/flora-chain-testnet-peer:latest`
51+
- **Tags**: `latest`, `main`, `v1.0.0`
52+
- **Platforms**: `linux/amd64`, `linux/arm64` (multi-architecture support)
53+
- **Size**: ~200MB (optimized for quick downloads)
54+
55+
### Available Tags
56+
57+
| Tag | Description |
58+
|-----|-------------|
59+
| `latest` | Latest stable release |
60+
| `main` | Latest from main branch |
61+
| `v1.0.0` | Specific version releases |
62+
63+
### Pull Command
64+
65+
```bash
66+
# Pull the latest image
67+
docker pull meta-flora/flora-chain-testnet-peer:latest
68+
69+
# Pull a specific version
70+
docker pull meta-flora/flora-chain-testnet-peer:v1.0.0
71+
```
72+
2573
## πŸ—οΈ Architecture
2674

2775
This setup uses:

β€Žsetup.shβ€Ž

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,42 @@ if ! docker info > /dev/null 2>&1; then
1010
exit 1
1111
fi
1212

13-
# Check if Docker Compose is available
14-
if ! command -v docker-compose > /dev/null 2>&1; then
15-
echo "❌ Docker Compose is not installed. Please install Docker Compose and try again."
16-
exit 1
13+
echo "βœ… Docker is available"
14+
15+
# Check if Docker Compose is available for local builds
16+
if command -v docker-compose > /dev/null 2>&1; then
17+
echo "βœ… Docker Compose is available"
18+
USE_DOCKER_COMPOSE=true
19+
else
20+
echo "⚠️ Docker Compose not found, using Docker Hub image instead"
21+
USE_DOCKER_COMPOSE=false
1722
fi
1823

19-
echo "βœ… Docker and Docker Compose are available"
24+
# Choose deployment method
25+
echo ""
26+
echo "πŸš€ Starting Flora Chain peer node..."
2027

21-
# Build and start the container
22-
echo "πŸš€ Building and starting Flora Chain peer node..."
23-
docker-compose up -d --build
28+
if [ "$USE_DOCKER_COMPOSE" = true ] && [ -f "docker-compose.yml" ]; then
29+
echo "πŸ“¦ Building and starting with Docker Compose..."
30+
docker-compose up -d --build
31+
CONTAINER_NAME="flora-peer"
32+
else
33+
echo "πŸ“¦ Pulling and starting from Docker Hub..."
34+
docker run -d --name flora-peer \
35+
-p 26656:26656 -p 26657:26657 -p 1317:1317 -p 9090:9090 \
36+
meta-flora/flora-chain-testnet-peer:latest
37+
CONTAINER_NAME="flora-peer"
38+
fi
2439

2540
# Wait a moment for the container to start
2641
sleep 5
2742

2843
# Check if container is running
29-
if docker ps | grep -q flora-peer; then
44+
if docker ps | grep -q "$CONTAINER_NAME"; then
3045
echo "βœ… Flora Chain peer node is running!"
3146
echo ""
3247
echo "πŸ“Š Monitor the node with:"
33-
echo " docker logs -f flora-peer"
48+
echo " docker logs -f $CONTAINER_NAME"
3449
echo ""
3550
echo "🌐 Access the node at:"
3651
echo " RPC: http://localhost:26657"
@@ -39,9 +54,13 @@ if docker ps | grep -q flora-peer; then
3954
echo " P2P: localhost:26656"
4055
echo ""
4156
echo "πŸ›‘ Stop the node with:"
42-
echo " docker-compose down"
57+
if [ "$USE_DOCKER_COMPOSE" = true ]; then
58+
echo " docker-compose down"
59+
else
60+
echo " docker stop $CONTAINER_NAME && docker rm $CONTAINER_NAME"
61+
fi
4362
else
4463
echo "❌ Failed to start Flora Chain peer node"
45-
echo "Check the logs with: docker-compose logs"
64+
echo "Check the logs with: docker logs $CONTAINER_NAME"
4665
exit 1
4766
fi

0 commit comments

Comments
Β (0)