Add docker support

This commit is contained in:
mainnet-pat 2024-08-12 09:54:37 +00:00
parent fea08d2b84
commit 3e76975348
3 changed files with 36 additions and 0 deletions

4
.dockerignore Normal file
View file

@ -0,0 +1,4 @@
target
data
Dockerfile
docker-compose.yml

23
Dockerfile Normal file
View file

@ -0,0 +1,23 @@
FROM debian:bookworm-slim AS builder
RUN apt update && apt install -y curl build-essential libsqlite3-dev
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.79.0
ENV PATH="/root/.cargo/bin:${PATH}"
COPY . /app
WORKDIR /app
RUN cargo install --path .
FROM debian:bookworm-slim
WORKDIR /app/
COPY --from=builder /root/.cargo/bin/riftenlabs-indexer /usr/local/bin/riftenlabs-indexer
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends sqlite3 \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 8000
ENV ROCKET_ENV=prod
ENV ROCKET_ADDRESS=0.0.0.0
CMD ["riftenlabs-indexer"]

9
docker-compose.yml Normal file
View file

@ -0,0 +1,9 @@
version: "3.8"
services:
indexer:
build: .
ports:
- "127.0.0.1:8000:8000"
volumes:
- ./data:/app
restart: always