-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add build and container event-indexer
- Loading branch information
Eshanchik
committed
Sep 11, 2024
1 parent
f96968a
commit 153ce5d
Showing
2 changed files
with
82 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
FROM debian:bullseye-slim AS builder | ||
WORKDIR /tmp/builder | ||
|
||
COPY . . | ||
|
||
ENV RUSTUP_HOME=/usr/local/rustup \ | ||
CARGO_HOME=/usr/local/cargo \ | ||
PATH=/usr/local/cargo/bin:$PATH \ | ||
RUST_VERSION=1.80 | ||
|
||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
gcc \ | ||
libc6-dev \ | ||
wget \ | ||
; \ | ||
dpkgArch="$(dpkg --print-architecture)"; \ | ||
case "${dpkgArch##*-}" in \ | ||
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='bb31eaf643926b2ee9f4d8d6fc0e2835e03c0a60f34d324048aa194f0b29a71c' ;; \ | ||
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='6626b90205d7fe7058754c8e993b7efd91dedc6833a11a225b296b7c2941194f' ;; \ | ||
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='4ccaa7de6b8be1569f6b764acc28e84f5eca342f5162cd5c810891bff7ed7f74' ;; \ | ||
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='34392b53a25c56435b411d3e575b63aab962034dd1409ba405e708610c829607' ;; \ | ||
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ | ||
esac; \ | ||
url="https://static.rust-lang.org/rustup/archive/1.25.2/${rustArch}/rustup-init"; \ | ||
wget "$url"; \ | ||
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ | ||
chmod +x rustup-init; \ | ||
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ | ||
rm rustup-init; \ | ||
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ | ||
rustup --version; \ | ||
cargo --version; \ | ||
rustc --version; \ | ||
apt-get remove -y --auto-remove \ | ||
wget \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/*; | ||
RUN apt-get update && apt-get install -y lsb-release ca-certificates libssl-dev pkg-config && \ | ||
rustup component add rustfmt clippy && \ | ||
cargo build --release | ||
|
||
|
||
FROM debian:bullseye-slim | ||
WORKDIR /app | ||
|
||
COPY --from=builder /tmp/builder/target/release/airdao-event-indexer . | ||
COPY --from=builder /tmp/builder/event-indexer /app/event-indexer | ||
|
||
RUN apt-get update && apt-get install -y lsb-release ca-certificates libssl-dev && apt-get clean all | ||
|
||
CMD ["./airdao-event-indexer"] |