forked from pagermon/pagermon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilder.pifile
75 lines (64 loc) · 2.42 KB
/
builder.pifile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#Latest Raspios Lite as of 23/12/2022 - https://www.raspberrypi.com/software/operating-systems/
FROM https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2024-03-15/2024-03-15-raspios-bookworm-armhf-lite.img.xz
TO /tmp/pagermon-pi.img
PUMP 1024M
# Enable SSH
RUN systemctl enable ssh
#Create User
RUN bash -c "echo "pi:raspberry" | chpasswd"
#Update
RUN apt-get update
RUN apt-get upgrade -y
#Build Deps
RUN apt-get install build-essential -y
RUN apt install -y sqlite \
python3 \
git \
vim \
htop \
curl \
wget \
unzip \
rtl-sdr
#Copy in Repo
INSTALL . /home/pi/pagermon/
#CHOWN pi
RUN chown -R pi:pi /home/pi/pagermon
#Install NVM
RUN bash -c "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash"
#Install Node20
RUN bash -c "nvm install 20"
RUN bash -c "node -v"
RUN bash -c "npm -v"
#Install Multimon-ng
RUN bash -c "apt install -y cmake && \
cd /tmp && \
git clone https://github.com/EliasOenal/multimon-ng.git && \
cd multimon-ng && \
git checkout 1.1.7 && \
mkdir build && \
cd build && \
cmake .. && \
make && \
sudo make install && \
rm -rf /tmp/multimon-ng"
#Becuase if we dont, its broken - NPM likes to use ssh?
RUN bash -c "mkdir /root/.ssh && touch /root/.ssh/known_hosts && chmod 600 /root/.ssh/known_hosts"
RUN bash -c "mkdir /home/pi/.ssh && touch /home/pi/.ssh/known_hosts && chown pi:pi /home/pi/.ssh/known_hosts && chmod 600 /home/pi/.ssh/known_hosts"
RUN bash -c "ssh-keyscan -t rsa github.com >> /root/.ssh/known_hosts"
RUN bash -c "ssh-keyscan -t rsa github.com >> /home/pi/.ssh/known_hosts"
#Setup Server
RUN bash -c "cd /home/pi/pagermon/server && \
npm install npm@latest -g --target_arch=arm --target_platform=linux && \
npm install pm2@latest -g --target_arch=arm --target_platform=linux && \
npm install --target_arch=arm --target_platform=linux && \
npm install sqlite3 --target_arch=arm --target_platform=linux && \
sudo -u pi cp process-default.json process.json && \
sudo -u pi sed -i 's:/home/ubuntu/workspace/server:/home/pi/pagermon/server:g' /home/pi/pagermon/server/process.json && \
export NODE_ENV=production && \
sudo -u pi pm2 start process.json && \
sleep 10 && \
sudo -u pi pm2 stop pagermon"
#Setup Client
RUN bash -c "cd /home/pi/pagermon/client && \
sudo -u pi npm install --target_arch=arm --target_platform=linux"