Skip to content

Commit

Permalink
feat: publishable docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Jul 22, 2024
1 parent e889990 commit 2219356
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
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 "$@"

0 comments on commit 2219356

Please sign in to comment.