Skip to content

Commit

Permalink
feat(cli): updating madara launcher to support full, sequencer, devne…
Browse files Browse the repository at this point in the history
…t modes (#282)
  • Loading branch information
antiyro authored Oct 1, 2024
1 parent e2c92eb commit 1ef808c
Show file tree
Hide file tree
Showing 5 changed files with 400 additions and 159 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Push Docker Image to GitHub Container Registry

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image to GitHub Container Registry
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/madara:latest
ghcr.io/${{ github.repository_owner }}/madara:${{ github.event.release.tag_name }}
labels: |
org.opencontainers.image.source=${{ github.repository.html_url }}
org.opencontainers.image.version=${{ github.event.release.tag_name }}
- name: Post successful message
run: echo "Docker image built and pushed successfully"
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Create Release

on:
push:
tags:
- "v*.*.*" # Triggers on version tags like v1.0.0

jobs:
create_release:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
commit: ${{ github.sha }}
draft: false
prerelease: false
generateReleaseNotes: true
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- feat(cli): launcher script and release workflows
- fix: cleaned cli settings for sequencer, devnet and full
- feat: move to karnot runner
- fix: docker file fixes for devnet
Expand Down
29 changes: 16 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ COPY crates crates
COPY cairo cairo
COPY cairo_0 cairo_0

# Installing scarb, new since devnet integration
# Installation steps are taken from the scarb build script
# https://github.com/software-mansion/scarb/blob/main/install.sh
ENV SCARB_VERSION="v2.8.2"
ENV SCARB_REPO="https://github.com/software-mansion/scarb/releases/download"
ENV PLATFORM="x86_64-unknown-linux-gnu"
ENV SCARB_TARGET="/usr/src/scarb.tar.gz"

RUN curl -fLS -o $SCARB_TARGET \
$SCARB_REPO/$SCARB_VERSION/scarb-$SCARB_VERSION-$PLATFORM.tar.gz && \
tar -xz -C /usr/src/ --strip-components=1 -f $SCARB_TARGET && \
mv /usr/src/bin/scarb /bin
# Installing Scarb
# Dynamically detect the architecture
ARG SCARB_VERSION="v2.8.2"
ARG SCARB_REPO="https://github.com/software-mansion/scarb/releases/download"
RUN ARCH=$(uname -m); \
if [ "$ARCH" = "x86_64" ]; then \
PLATFORM="x86_64-unknown-linux-gnu"; \
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
PLATFORM="aarch64-unknown-linux-gnu"; \
else \
echo "Unsupported architecture: $ARCH"; exit 1; \
fi && \
curl -fLS -o /usr/src/scarb.tar.gz \
$SCARB_REPO/$SCARB_VERSION/scarb-$SCARB_VERSION-$PLATFORM.tar.gz && \
tar -xz -C /usr/local --strip-components=1 -f /usr/src/scarb.tar.gz

# Build the application in release mode
RUN cargo build --release
Expand All @@ -49,7 +52,7 @@ WORKDIR /usr/local/bin
# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/madara/target/release/madara .

# chain presets to be monted at startup
# Chain presets to be mounted at startup
VOLUME crates/primitives/chain_config/presets
VOLUME crates/primitives/chain_config/resources

Expand Down
Loading

0 comments on commit 1ef808c

Please sign in to comment.