Created
July 14, 2023 04:31
-
-
Save sleepdefic1t/148533d23d12a581bbae6603f6197160 to your computer and use it in GitHub Desktop.
Dockerfile for Solar Network Core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [email protected]; \ | |
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