-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-build-amd64.sh
72 lines (58 loc) · 2.15 KB
/
docker-build-amd64.sh
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
#!/usr/bin/env bash
# fail on error
set -e
# Retry 5 times with a wait of 10 seconds between each retry
tryfail() {
for i in $(seq 1 5);
do [ $i -gt 1 ] && sleep 10; $* && s=0 && break || s=$?; done;
(exit $s)
}
if [ "x${1}" == "x" ]; then
echo please pass PKGURL as an environment variable
exit 0
fi
apt-get update
apt-get install -qy --no-install-recommends \
apt-transport-https \
dirmngr \
gpg \
curl \
gpg-agent \
openjdk-17-jre-headless \
procps \
libcap2-bin \
tzdata
# Add MongoDB Key & Repo
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg -o /etc/apt/keyrings/mongodb-server-7.0.gpg --dearmor
echo 'deb [ arch=amd64,arm64 signed-by=/etc/apt/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse' | tee /etc/apt/sources.list.d/mongodb-org-7.0.list
apt-get update
apt-get install -qy --no-install-recommends \
mongodb-org-server \
mongodb-org-shell \
mongodb-org-tools \
mongodb-org-mongos \
mongodb-mongosh \
mongodb-org-database
curl -fsSL https://dl.ui.com/unifi/unifi-repo.gpg -o /etc/apt/keyrings/unifi-repo.gpg
echo 'deb [ arch=amd64,arm64 signed-by=/etc/apt/keyrings/unifi-repo.gpg ] https://www.ui.com/downloads/unifi/debian stable ubiquiti' | tee /etc/apt/sources.list.d/unifi.list
if [ -d "/usr/local/docker/pre_build/$(dpkg --print-architecture)" ]; then
find "/usr/local/docker/pre_build/$(dpkg --print-architecture)" -type f -exec '{}' \;
fi
curl -L -o ./unifi.deb "${1}"
apt -qy install ./unifi.deb
rm -f ./unifi.deb
chown -R unifi:unifi /usr/lib/unifi
rm -rf /var/lib/apt/lists/*
sed -i 's|/var/lib/mongodb|/unifi/data/db|g' /etc/mongod.conf
sed -i 's|/var/log/mongodb/mongod.log|/unifi/log/mongod.log|g' /etc/mongod.conf
rm -rf ${ODATADIR} ${OLOGDIR} ${ORUNDIR} ${BASEDIR}/data ${BASEDIR}/run ${BASEDIR}/logs
mkdir -p ${DATADIR} ${LOGDIR} ${RUNDIR}
ln -s ${DATADIR} ${BASEDIR}/data
ln -s ${RUNDIR} ${BASEDIR}/run
ln -s ${LOGDIR} ${BASEDIR}/logs
ln -s ${DATADIR} ${ODATADIR}
ln -s ${LOGDIR} ${OLOGDIR}
ln -s ${RUNDIR} ${ORUNDIR}
mkdir -p /var/cert ${CERTDIR}
ln -s ${CERTDIR} /var/cert/unifi
rm -rf "${0}"