-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docs): updated readme and fixed launcher (#298)
Co-authored-by: Apoorv Sadana <[email protected]>
- Loading branch information
1 parent
9724575
commit 6e69868
Showing
5 changed files
with
307 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,48 @@ | ||
# Stage 1: Build the application | ||
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 | ||
# Copy the source code into the container | ||
COPY Cargo.toml Cargo.lock ./ | ||
COPY crates crates | ||
COPY cairo cairo | ||
COPY cairo_0 cairo_0 | ||
|
||
# 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 | ||
|
||
# Installing scarb, new since devnet integration | ||
ENV SCARB_VERSION="v2.8.2" | ||
ENV SHELL="/bin/bash" | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- ${SCARB_VERSION} | ||
ENV PATH="/root/.local/bin:${PATH}" | ||
RUN scarb --version | ||
|
||
# Install runtime dependencies | ||
RUN apt-get -y update && \ | ||
apt-get install -y openssl ca-certificates busybox && \ | ||
apt-get autoremove -y; \ | ||
apt-get clean; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Build the application in release mode | ||
RUN cargo build --release | ||
|
||
# Stage 2: Create the final runtime image | ||
FROM debian:bookworm-slim | ||
|
||
FROM debian:bookworm | ||
# Install runtime dependencies | ||
RUN apt-get -y update && \ | ||
apt-get install -y openssl ca-certificates && \ | ||
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 | ||
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 mounted at startup | ||
VOLUME crates/primitives/chain_config/presets | ||
VOLUME crates/primitives/chain_config/resources | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["./madara"] |
Oops, something went wrong.