Files
psf-memo/psf-memo-indexer/production/docker/tx-indexer/Dockerfile
T

48 lines
1.5 KiB
Docker
Raw Normal View History

2026-08-26 09:30:44 -07:00
# Create a Dockerized tx indexer
#
2026-08-26 12:05:01 -07:00
# Build context: psf-memo monorepo root
# docker compose build tx-indexer
2026-08-26 09:30:44 -07:00
FROM ubuntu:24.04
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
2026-08-26 12:05:01 -07:00
RUN apt-get update && apt-get install -y sudo curl nano gnupg wget zip unzip python3 \
&& rm -rf /var/lib/apt/lists/*
2026-08-26 09:30:44 -07:00
#Install Node and NPM
2026-08-26 12:05:01 -07:00
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh \
&& bash nodesource_setup.sh \
&& apt-get update && apt-get install -y nodejs build-essential \
&& rm -rf /var/lib/apt/lists/*
2026-08-26 09:30:44 -07:00
#Create the user 'safeuser' and add them to the sudo group.
RUN useradd -ms /bin/bash safeuser
RUN adduser safeuser sudo
#Set password to 'password' change value below if you want a different password
RUN echo safeuser:password | chpasswd
#Set the working directory to be the home directory
WORKDIR /home/safeuser
#Setup NPM for non-root global install
RUN mkdir /home/safeuser/.npm-global
RUN chown -R safeuser .npm-global
RUN echo "export PATH=~/.npm-global/bin:$PATH" >> /home/safeuser/.profile
RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'"
2026-08-26 12:05:01 -07:00
# Copy psf-memo-indexer from the monorepo
COPY psf-memo-indexer /home/safeuser/psf-memo-indexer
2026-08-26 09:30:44 -07:00
WORKDIR /home/safeuser/psf-memo-indexer
# Install dependencies
RUN npm install
# Expose the port the API will be served on.
EXPOSE 5455
# Start the application.
# start-tx-indexer.sh is mounted at runtime via docker-compose.
CMD ["./start-tx-indexer.sh"]