Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: publishable docker image #62

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ documentation/docs/dist
documentation/vocs.config.ts*
graphql/node_modules
rindexer_rust_playground/generated_csv/*/*.csv
.direnv
._*
_
8 changes: 8 additions & 0 deletions dockerfiles/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ignore everything
*

# except the following
!Dockerfile
!.dockerignore
!scripts
!rindexer
67 changes: 67 additions & 0 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# syntax = docker/dockerfile:1.6
FROM rust:bookworm AS builder

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NOWARNINGS="yes"
ARG DEBCONF_TERSE="yes"
ARG LANG="C.UTF-8"

WORKDIR /app

RUN apt-get update --yes \
&& apt-get install --yes --no-install-recommends \
ca-certificates \
curl \
unzip \
&& apt-get autoremove --yes \
&& apt-get clean --yes \
&& rm -rf /var/lib/apt/lists/*

# Install rundexer
RUN set -x && \
curl \
--fail \
--silent \
--location \
--show-error \
--url https://rindexer.xyz/install.sh | \
sed 's/curl -sSf -L "$RESOURCES_URL" -o "$RINDEXER_DIR\/resources.zip"/curl -sSf -L "$RESOURCES_URL" -o "$RINDEXER_DIR\/resources.zip" || echo "Failed to download resources.zip"/' | \
sed 's/unzip -o "$RINDEXER_DIR\/resources.zip"/[ -f "$RINDEXER_DIR\/resources.zip" ] \&\& unzip -o "$RINDEXER_DIR\/resources.zip" || echo "Skipping unzip, resources.zip not found"/' | \
sed 's/rm "$RINDEXER_DIR\/resources.zip"/rm -f "$RINDEXER_DIR\/resources.zip"/' | \
bash

FROM debian:bookworm-slim AS runtime

ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NOWARNINGS="yes"
ARG DEBCONF_TERSE="yes"
ARG LANG="C.UTF-8"

# where rindexer.yaml and a JSON abi file are located
# make sure the project path is in .dockerignore
ARG PROJECT_PATH="./rindexer"

ENV PATH="/root/.rindexer/bin:${PATH}"

WORKDIR /app

RUN apt-get update --yes \
&& apt-get install --yes --no-install-recommends \
ca-certificates \
bash \
sudo \
openssl \
&& apt-get autoremove --yes \
&& apt-get clean --yes \
&& rm -rf /var/lib/apt/lists/*

# Copy rindexer from builder stage
COPY --from=builder /root/.rindexer /root/.rindexer
COPY ${PROJECT_PATH} ${PROJECT_PATH}

COPY ./scripts/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
7 changes: 7 additions & 0 deletions dockerfiles/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -e

echo "Running $(/root/.rindexer/bin/rindexer --version)"

exec "$@"
Loading