forked from jprjr/turtlecoin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
83 lines (76 loc) · 3.41 KB
/
Dockerfile
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
76
77
78
79
80
81
82
83
# daemon runs in the background
# run something like tail /var/log/xariad/current to see the status
# be sure to run with volumes, ie:
# docker run -v $(pwd)/xariad:/var/lib/xariad -v $(pwd)/wallet:/home/xaria --rm -ti xaria:0.2.2
ARG base_image_version=0.10.0
FROM phusion/baseimage:$base_image_version
ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.2/s6-overlay-amd64.tar.gz /tmp/
RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C /
ADD https://github.com/just-containers/socklog-overlay/releases/download/v2.1.0-0/socklog-overlay-amd64.tar.gz /tmp/
RUN tar xzf /tmp/socklog-overlay-amd64.tar.gz -C /
ARG XARIA_BRANCH=master
ENV XARIA_BRANCH=${XARIA_BRANCH}
# install build dependencies
# checkout the latest tag
# build and install
RUN apt-get update && \
apt-get install -y \
build-essential \
python-dev \
gcc-4.9 \
g++-4.9 \
git cmake \
libboost1.58-all-dev \
librocksdb-dev && \
git clone https://github.com/xaria-coin/xaria.git /src/xaria && \
cd /src/xaria && \
git checkout $XARIA_BRANCH && \
mkdir build && \
cd build && \
cmake -DCMAKE_CXX_FLAGS="-g0 -Os -fPIC -std=gnu++11" .. && \
make -j$(nproc) && \
mkdir -p /usr/local/bin && \
cp src/TurtleCoind /usr/local/bin/Xariad && \
cp src/walletd /usr/local/bin/walletd && \
cp src/zedwallet /usr/local/bin/zedwallet && \
cp src/miner /usr/local/bin/miner && \
strip /usr/local/bin/TurtleCoind && \
strip /usr/local/bin/walletd && \
strip /usr/local/bin/zedwallet && \
strip /usr/local/bin/miner && \
cd / && \
rm -rf /src/xaria && \
apt-get remove -y build-essential python-dev gcc-4.9 g++-4.9 git cmake libboost1.58-all-dev librocksdb-dev && \
apt-get autoremove -y && \
apt-get install -y \
libboost-system1.58.0 \
libboost-filesystem1.58.0 \
libboost-thread1.58.0 \
libboost-date-time1.58.0 \
libboost-chrono1.58.0 \
libboost-regex1.58.0 \
libboost-serialization1.58.0 \
libboost-program-options1.58.0 \
libicu55
# setup the xariad service
RUN useradd -r -s /usr/sbin/nologin -m -d /var/lib/xariad xariad && \
useradd -s /bin/bash -m -d /home/xaria xaria && \
mkdir -p /etc/services.d/xariad/log && \
mkdir -p /var/log/xariad && \
echo "#!/usr/bin/execlineb" > /etc/services.d/xariad/run && \
echo "fdmove -c 2 1" >> /etc/services.d/xariad/run && \
echo "cd /var/lib/xariad" >> /etc/services.d/xariad/run && \
echo "export HOME /var/lib/xariad" >> /etc/services.d/xariad/run && \
echo "s6-setuidgid xariad /usr/local/bin/TurtleCoind" >> /etc/services.d/xariad/run && \
chmod +x /etc/services.d/xariad/run && \
chown nobody:nogroup /var/log/xariad && \
echo "#!/usr/bin/execlineb" > /etc/services.d/xariad/log/run && \
echo "s6-setuidgid nobody" >> /etc/services.d/xariad/log/run && \
echo "s6-log -bp -- n20 s1000000 /var/log/xariad" >> /etc/services.d/xariad/log/run && \
chmod +x /etc/services.d/xariad/log/run && \
echo "/var/lib/xariad true xariad 0644 0755" > /etc/fix-attrs.d/xariad-home && \
echo "/home/xaria true xaria 0644 0755" > /etc/fix-attrs.d/xaria-home && \
echo "/var/log/xariad true nobody 0644 0755" > /etc/fix-attrs.d/xariad-logs
VOLUME ["/var/lib/xariad", "/home/xaria","/var/log/xariad"]
ENTRYPOINT ["/init"]
CMD ["/usr/bin/execlineb", "-P", "-c", "emptyenv cd /home/xaria export HOME /home/xaria s6-setuidgid xaria /bin/bash"]