Skip to content

Commit

Permalink
add build and container event-indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
Eshanchik committed Sep 11, 2024
1 parent f96968a commit 153ce5d
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build_and_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,31 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build_and_publish_indexer:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v3
id: meta
with:
images: ghcr.io/ambrosus/airdao-event-indexer

- name: Build and push
uses: docker/build-push-action@v2
with:
file: Dockerfile_indexer
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
54 changes: 54 additions & 0 deletions Dockerfile_indexer
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"]

0 comments on commit 153ce5d

Please sign in to comment.