forked from Wireless-Medical/bc-ipfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
152 lines (128 loc) · 4.04 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
FROM blcksync/go11-node:latest as builder
ENV SHELL=/bin/bash \
IPFS_USER=ipfsuser \
IPFS_UID=3888 \
IPFS_GID=4888 \
GOPATH=/go
ENV HOME=/home/$IPFS_USER
ARG BUILD_BRANCH=$BUILD_BRANCH
WORKDIR /root
RUN addgroup -g $IPFS_GID $IPFS_USER && \
adduser -u $IPFS_UID -g $IPFS_GID -h $HOME -S -s /bin/bash $IPFS_USER && \
chmod g+w /etc/passwd /etc/group && \
source /etc/profile.d/go_path.sh && \
chown -R $IPFS_UID:$IPFS_GID $HOME && \
apk update && apk upgrade && \
apk add --no-cache bash git \
busybox-extras \
python \
python-dev \
py-pip \
libtool \
autoconf \
automake \
build-base \
make gcc musl-dev linux-headers \
&& rm -rf /var/cache/apk/* && \
echo "export PATH=/usr/local/go/bin:\$GOPATH/bin:\$PATH:\$HOME/bin" > /etc/profile.d/go_path.sh
# Install go-ipfs and gx
RUN source /etc/profile.d/go_path.sh && \
go get -u -d github.com/ipfs/go-ipfs && cd $GOPATH/src/github.com/ipfs/go-ipfs && \
git checkout fix/disable-keepalives && \
make install_unsupported
# Install geth
RUN cd /root; \
git clone -b release/1.8 --depth 1 https://github.com/matr1xc0in/go-ethereum.git && \
cd /root/go-ethereum && make geth
COPY bc-ipfs $HOME/bc-ipfs
RUN chown -R $IPFS_UID:$IPFS_GID $HOME/bc-ipfs
USER $IPFS_UID
WORKDIR $HOME
# Install ipfs JS API
RUN mkdir $HOME/bin && \
npm install --save \
&& ln -s $HOME/node_modules/dat/bin/cli.js $HOME/bin/dat ; \
cd $HOME/bc-ipfs; \
npm install; \
npm install -S [email protected] \
@types/[email protected] \
&& npm install -S @types/[email protected] \
FROM blcksync/alpine-node:latest
LABEL maintainer="matr1xc0in"
ENV SHELL=/bin/bash \
IPFS_USER=ipfsuser \
IPFS_UID=3888 \
IPFS_GID=4888 \
GOPATH=/go
ENV HOME=/home/$IPFS_USER
USER root
WORKDIR /root
RUN apk update && apk upgrade && \
apk add --no-cache ca-certificates bash git busybox-extras && \
rm -rf /var/cache/apk/* && \
echo "export PATH=/usr/local/go/bin:\$GOPATH/bin:\$PATH:\$HOME/bin" > /etc/profile.d/go_path.sh
COPY --from=builder /usr/local/go/bin/* /usr/local/go/bin/
COPY --from=builder /go/bin/* /go/bin/
COPY --from=builder /root/go-ethereum/build/bin/geth /usr/local/bin/
COPY --from=builder $HOME/bc-ipfs $HOME/
# Install go-ipfs and gx
RUN addgroup -g $IPFS_GID $IPFS_USER && \
adduser -u $IPFS_UID -g $IPFS_GID -h $HOME -S -s /bin/bash $IPFS_USER && \
chmod g+w /etc/passwd /etc/group && \
source /etc/profile.d/go_path.sh && \
chown -R $IPFS_UID:$IPFS_GID $HOME && \
chown -R $IPFS_UID:$IPFS_GID /usr/local/bin/geth && \
chown -R $IPFS_UID:$IPFS_GID /usr/local/go/bin/* && \
chown -R $IPFS_UID:$IPFS_GID /go/bin/* && \
mkdir -p $HOME/ipfs && chown -R $IPFS_UID:$IPFS_GID $HOME/ipfs ; \
echo "export IPFS_PATH=$HOME/ipfs" > /etc/profile.d/ipfs_path.sh
ENV IPFS_VERSION=0.4.15 \
IPFS_SHA256=48a81cfc34d3a12c8563dbdfae8681be6e4d23c0664d6a192bc2758c4e4ef377
USER $IPFS_UID
WORKDIR $HOME
COPY ./bin/*.sh $HOME/bin/
CMD ["/home/ipfsuser/bin/launch.sh"]
EXPOSE 3000
# Ports for Swarm TCP, Swarm uTP, API, Gateway, Swarm Websockets
EXPOSE 4001
EXPOSE 4002/udp
EXPOSE 5001
EXPOSE 8080
EXPOSE 8081
# Geth ports
EXPOSE 8545 8546 30303 30303/udp