Updating Docker files for mono repo

This commit is contained in:
Chris Troutner
2026-08-26 12:05:01 -07:00
parent b58f360c89
commit 69c38d5a36
12 changed files with 114 additions and 79 deletions
@@ -1,18 +1,20 @@
# Create a Dockerized block indexer
#
# Build context: psf-memo monorepo root
# docker compose build block-indexer
#IMAGE BUILD COMMANDS
FROM ubuntu:24.04
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget zip unzip python3
RUN apt-get update && apt-get install -y sudo curl nano gnupg wget zip unzip python3 \
&& rm -rf /var/lib/apt/lists/*
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
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/*
#Create the user 'safeuser' and add them to the sudo group.
RUN useradd -ms /bin/bash safeuser
@@ -30,17 +32,10 @@ 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'"
# Clone the psf-memo-indexer repository
WORKDIR /home/safeuser
RUN git clone https://github.com/Permissionless-Software-Foundation/psf-memo-indexer
# Switch to the desired branch. `master` is usually stable,
# and `stage` has the most up-to-date changes.
# Copy psf-memo-indexer from the monorepo
COPY psf-memo-indexer /home/safeuser/psf-memo-indexer
WORKDIR /home/safeuser/psf-memo-indexer
# For development: switch to unstable branch
#RUN git checkout <branch-name>
# Install dependencies
RUN npm install
@@ -1,8 +1,16 @@
# Start the service with: docker-compose up -d
# Build and start from this directory:
# docker compose build
# docker compose up -d
#
# Build context is the psf-memo monorepo root (../../../) so each
# image copies its package from the local checkout rather than cloning
# separate GitHub repositories.
services:
memo-db:
build: ./memo-db
build:
context: ../../..
dockerfile: psf-memo-indexer/production/docker/memo-db/Dockerfile
container_name: memo-db
logging:
driver: json-file
@@ -18,7 +26,9 @@ services:
restart: always
tx-indexer:
build: ./tx-indexer
build:
context: ../../..
dockerfile: psf-memo-indexer/production/docker/tx-indexer/Dockerfile
image: memo-tx-indexer
container_name: memo-tx-indexer
logging:
@@ -34,7 +44,9 @@ services:
restart: always
block-indexer:
build: ./block-indexer
build:
context: ../../..
dockerfile: psf-memo-indexer/production/docker/block-indexer/Dockerfile
image: memo-block-indexer
container_name: memo-block-indexer
logging:
@@ -48,7 +60,9 @@ services:
restart: always
memo-client:
build: ./memo-client
build:
context: ../../..
dockerfile: psf-memo-indexer/production/docker/memo-client/Dockerfile
image: memo-client
container_name: memo-client
logging:
@@ -1,38 +1,35 @@
# Create a Dockerized front-end SPA served by nginx
#
# Build context: psf-memo monorepo root
# docker compose build memo-client
#IMAGE BUILD COMMANDS
FROM ubuntu:24.04 as builder
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget
RUN apt-get update && apt-get install -y sudo curl nano gnupg wget \
&& rm -rf /var/lib/apt/lists/*
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
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/*
#Set the working directory to be the home directory
WORKDIR /home/safeuser
# Clone the psf-memo-client repository
RUN git clone https://github.com/Permissionless-Software-Foundation/psf-memo-client
# Switch to the desired branch. `master` is usually stable,
# and `stage` / `unstable` have the most up-to-date changes.
# Copy psf-memo-client from the monorepo
COPY psf-memo-client /home/safeuser/psf-memo-client
WORKDIR /home/safeuser/psf-memo-client
# For development: switch to unstable branch
#RUN git checkout unstable
# Install dependencies
RUN npm install
# Create React App reads REACT_APP_* from this .env at build time.
# Edit production/docker/memo-client/.env before building.
COPY .env .env
COPY psf-memo-indexer/production/docker/memo-client/.env .env
# Install dependencies
RUN npm install
# Build the site
RUN npm run build
@@ -45,4 +42,4 @@ EXPOSE 80
COPY --from=builder /home/safeuser/psf-memo-client/build /usr/share/nginx/html
# Copy the NGINX configuration file.
COPY default.conf /etc/nginx/conf.d/default.conf
COPY psf-memo-indexer/production/docker/memo-client/default.conf /etc/nginx/conf.d/default.conf
@@ -1,18 +1,20 @@
# Create a Dockerized API server
#
# Build context: psf-memo monorepo root
# docker compose build memo-db
#IMAGE BUILD COMMANDS
FROM ubuntu:24.04
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget zip unzip python3
RUN apt-get update && apt-get install -y sudo curl nano gnupg wget zip unzip python3 \
&& rm -rf /var/lib/apt/lists/*
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
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/*
#Create the user 'safeuser' and add them to the sudo group.
RUN useradd -ms /bin/bash safeuser
@@ -30,17 +32,10 @@ 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'"
# Clone the psf-memo-db repository
WORKDIR /home/safeuser
RUN git clone https://github.com/Permissionless-Software-Foundation/psf-memo-db
# Switch to the desired branch. `master` is usually stable,
# and `stage` has the most up-to-date changes.
# Copy psf-memo-db from the monorepo
COPY psf-memo-db /home/safeuser/psf-memo-db
WORKDIR /home/safeuser/psf-memo-db
# For development: switch to unstable branch
#RUN git checkout <branch-name>
# Install dependencies
RUN npm install
@@ -1,18 +1,20 @@
# Create a Dockerized tx indexer
#
# Build context: psf-memo monorepo root
# docker compose build tx-indexer
#IMAGE BUILD COMMANDS
FROM ubuntu:24.04
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget zip unzip python3
RUN apt-get update && apt-get install -y sudo curl nano gnupg wget zip unzip python3 \
&& rm -rf /var/lib/apt/lists/*
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install -y nodejs build-essential
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/*
#Create the user 'safeuser' and add them to the sudo group.
RUN useradd -ms /bin/bash safeuser
@@ -30,17 +32,10 @@ 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'"
# Clone the psf-memo-indexer repository
WORKDIR /home/safeuser
RUN git clone https://github.com/Permissionless-Software-Foundation/psf-memo-indexer
# Switch to the desired branch. `master` is usually stable,
# and `stage` has the most up-to-date changes.
# Copy psf-memo-indexer from the monorepo
COPY psf-memo-indexer /home/safeuser/psf-memo-indexer
WORKDIR /home/safeuser/psf-memo-indexer
# For development: switch to unstable branch
#RUN git checkout <branch-name>
# Install dependencies
RUN npm install