Skip to content

Instantly share code, notes, and snippets.

@sleepdefic1t
Created July 14, 2023 04:31
Show Gist options
  • Save sleepdefic1t/148533d23d12a581bbae6603f6197160 to your computer and use it in GitHub Desktop.
Save sleepdefic1t/148533d23d12a581bbae6603f6197160 to your computer and use it in GitHub Desktop.
Dockerfile for Solar Network Core
FROM ubuntu:22.04
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
build-essential \
curl \
git \
ntp \
postgresql \
postgresql-client \
python3; \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -; \
apt-get update; \
apt-get install nodejs -y; \
ln -s /core/packages/core/bin/run /usr/bin/solar; \
ln -s /usr/lib/postgresql/*/bin/initdb /usr/bin/initdb; \
ln -s /usr/lib/postgresql/*/bin/pg_ctl /usr/bin/pg_ctl; \
npm install -g pnpm@6.32.11; \
pnpm -g install pm2; \
mkdir -p /core /data/config /data/logs /data/network; \
useradd -ms /bin/bash solar; \
chown -R solar:solar /core /data
USER solar
ENV POSTGRES_DIR=/usr
ENV USER=solar
ENV XDG_CONFIG_HOME=/data/config
ENV XDG_DATA_HOME=/data/network
ENV XDG_STATE_HOME=/data/logs
ARG network=testnet
ARG version
RUN if [ "$network" != "testnet" ] && [ "$network" != "mainnet" ]; then echo "ERROR: Invalid network!"; exit 1;else echo "SUCCESS: $network is supported!"; fi
RUN git clone "https://github.com/solar-network/core.git" /core; \
cd /core; \
pnpm install; \
pnpm build; \
mkdir /home/solar/.solar; \
touch /home/solar/.solar/.env; \
solar config:publish --network=${network}; \
solar database:create --network=${network}; \
pg_ctl stop -D /data/network/solar-core/${network}/database
VOLUME /data
EXPOSE 6001
EXPOSE 6003
CMD ["solar", "relay:run"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment