Skip to content

Commit

Permalink
fix docker file (#281)
Browse files Browse the repository at this point in the history
Co-authored-by: trantorian <[email protected]>
  • Loading branch information
apoorvsadana and Trantorian1 authored Sep 24, 2024
1 parent 1b9b0d5 commit 85fb08e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 18 deletions.
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

- fix: docker file fixes for devnet
- fix(block-production): fix bouncer calculation and declared classes
- fix: Fix pending block sync and add real FGW tests
- test: tests added for verify and apply task in l2 sync
Expand Down
41 changes: 30 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
# Stage 1: Build the application
FROM rust:1.78 as builder
FROM rust:1.78 AS builder

# Install build dependencies
RUN apt-get -y update && \
RUN apt-get -y update && \
apt-get install -y clang && \
apt-get autoremove -y; \
apt-get clean; \
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /usr/src/madara/

# Copy the source code into the container
# Copy the source code
COPY Cargo.toml Cargo.lock ./
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

# Build the application in release mode
RUN cargo build --release

# Stage 2: Create the final runtime image
FROM debian:bookworm
FROM debian:bookworm-slim

# Install runtime dependencies
RUN apt-get -y update && \
apt-get install -y openssl ca-certificates tini &&\
apt-get autoremove -y; \
apt-get clean; \
RUN apt-get -y update && \
apt-get install -y openssl ca-certificates && \
apt-get autoremove -y; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*

# Set the working directory
Expand All @@ -34,5 +49,9 @@ 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
VOLUME crates/primitives/chain_config/presets
VOLUME crates/primitives/chain_config/resources

# Set the entrypoint
CMD ["./madara"]
ENTRYPOINT ["./madara"]
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@ Madara is a powerfull Starknet hybrid client written in Rust.
To run Madara with Docker, use the following command:

```sh
docker run -d \
--name madara \
-p 9944:9944 \
docker run -d \
--name madara \
-p 9944:9944 \
-v /var/lib/madara:/var/lib/madara \
madara:latest \
--base-path ../madara-db \
--network main \
--l1-endpoint <rpc key> \
madara:latest \
--base-path ./madara-db \
--network main \
--rpc-external \
--rpc-cors all \
--preset mainnet \
--l1-endpoint <rpc key>
```

Check the logs of the running Madara service:
Expand Down

0 comments on commit 85fb08e

Please sign in to comment.