|
1 | 1 | # Stage 1: Build the application |
2 | 2 | FROM rust:1.78 AS builder |
3 | | - |
4 | 3 | # Install build dependencies |
5 | | -RUN apt-get -y update && \ |
| 4 | +RUN apt-get -y update && \ |
6 | 5 | apt-get install -y clang && \ |
7 | | - apt-get autoremove -y; \ |
8 | | - apt-get clean; \ |
| 6 | + apt-get autoremove -y; \ |
| 7 | + apt-get clean; \ |
9 | 8 | rm -rf /var/lib/apt/lists/* |
10 | | - |
11 | 9 | # Set the working directory |
12 | 10 | WORKDIR /usr/src/madara/ |
13 | | - |
14 | | -# Copy the source code |
| 11 | +# Copy the source code into the container |
15 | 12 | COPY Cargo.toml Cargo.lock ./ |
16 | 13 | COPY crates crates |
17 | 14 | COPY cairo cairo |
18 | 15 | COPY cairo_0 cairo_0 |
19 | 16 |
|
20 | | -# Installing Scarb |
21 | | -# Dynamically detect the architecture |
22 | | -ARG SCARB_VERSION="v2.8.2" |
23 | | -ARG SCARB_REPO="https://github.com/software-mansion/scarb/releases/download" |
24 | | -RUN ARCH=$(uname -m); \ |
25 | | - if [ "$ARCH" = "x86_64" ]; then \ |
26 | | - PLATFORM="x86_64-unknown-linux-gnu"; \ |
27 | | - elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \ |
28 | | - PLATFORM="aarch64-unknown-linux-gnu"; \ |
29 | | - else \ |
30 | | - echo "Unsupported architecture: $ARCH"; exit 1; \ |
31 | | - fi && \ |
32 | | - curl -fLS -o /usr/src/scarb.tar.gz \ |
33 | | - $SCARB_REPO/$SCARB_VERSION/scarb-$SCARB_VERSION-$PLATFORM.tar.gz && \ |
34 | | - tar -xz -C /usr/local --strip-components=1 -f /usr/src/scarb.tar.gz |
| 17 | + |
| 18 | +# Installing scarb, new since devnet integration |
| 19 | +ENV SCARB_VERSION="v2.8.2" |
| 20 | +ENV SHELL="/bin/bash" |
| 21 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- ${SCARB_VERSION} |
| 22 | +ENV PATH="/root/.local/bin:${PATH}" |
| 23 | +RUN scarb --version |
| 24 | + |
| 25 | +# Install runtime dependencies |
| 26 | +RUN apt-get -y update && \ |
| 27 | + apt-get install -y openssl ca-certificates busybox && \ |
| 28 | + apt-get autoremove -y; \ |
| 29 | + apt-get clean; \ |
| 30 | + rm -rf /var/lib/apt/lists/* |
35 | 31 |
|
36 | 32 | # Build the application in release mode |
37 | 33 | RUN cargo build --release |
38 | | - |
39 | 34 | # Stage 2: Create the final runtime image |
40 | | -FROM debian:bookworm-slim |
41 | | - |
| 35 | +FROM debian:bookworm |
42 | 36 | # Install runtime dependencies |
43 | | -RUN apt-get -y update && \ |
44 | | - apt-get install -y openssl ca-certificates && \ |
45 | | - apt-get autoremove -y; \ |
46 | | - apt-get clean; \ |
| 37 | +RUN apt-get -y update && \ |
| 38 | + apt-get install -y openssl ca-certificates &&\ |
| 39 | + apt-get autoremove -y; \ |
| 40 | + apt-get clean; \ |
47 | 41 | rm -rf /var/lib/apt/lists/* |
48 | | - |
49 | 42 | # Set the working directory |
50 | 43 | WORKDIR /usr/local/bin |
51 | | - |
52 | 44 | # Copy the compiled binary from the builder stage |
53 | 45 | COPY --from=builder /usr/src/madara/target/release/madara . |
54 | 46 |
|
55 | | -# Chain presets to be mounted at startup |
56 | | -VOLUME crates/primitives/chain_config/presets |
57 | | -VOLUME crates/primitives/chain_config/resources |
58 | | - |
59 | 47 | # Set the entrypoint |
60 | 48 | ENTRYPOINT ["./madara"] |
0 commit comments