-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from blcksync/add-eth-integration
Add auto-launch script run.sh for user to double-click and kick off jobs
- Loading branch information
Showing
4 changed files
with
97 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,94 @@ | ||
FROM go-node:latest | ||
|
||
LABEL maintainer="matr1xc0in" | ||
FROM go-node:latest as builder | ||
|
||
ENV SHELL=/bin/bash \ | ||
IPFS_USER=ipfsuser \ | ||
IPFS_UID=3888 \ | ||
IPFS_GID=4888 | ||
IPFS_GID=4888 \ | ||
GOPATH=/go | ||
ENV HOME=/home/$IPFS_USER | ||
|
||
USER root | ||
WORKDIR /root | ||
|
||
RUN apk update && apk upgrade && \ | ||
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 \ | ||
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 | ||
|
||
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 | ||
# 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 && \ | ||
make install_unsupported | ||
|
||
ENV IPFS_VERSION=0.4.15 \ | ||
IPFS_SHA256=48a81cfc34d3a12c8563dbdfae8681be6e4d23c0664d6a192bc2758c4e4ef377 | ||
# 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 | ||
|
||
USER $IPFS_UID | ||
|
||
WORKDIR $HOME | ||
|
||
# Install ipfs JS API | ||
RUN mkdir $HOME/bin && \ | ||
npm install --save \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
&& ln -s $HOME/node_modules/dat/bin/cli.js $HOME/bin/dat ; \ | ||
cd $HOME; git clone --depth 1 -b master https://github.com/blcksync/bc-ipfs.git; \ | ||
cd bc-ipfs/bc-ipfs && npm install | ||
|
||
# RUN cd /tmp/ && \ | ||
# wget -O go-ipfs.tgz https://dist.ipfs.io/go-ipfs/v${IPFS_VERSION}/go-ipfs_v${IPFS_VERSION}_linux-amd64.tar.gz && \ | ||
# echo "${IPFS_SHA256} go-ipfs.tgz" | sha256sum -c -; \ | ||
# tar -xzf go-ipfs.tgz \ | ||
# && cd go-ipfs* \ | ||
# && bash install.sh | ||
FROM alpine-node:latest | ||
|
||
# add to image and unzip it | ||
COPY ./bc-ipfs-example $HOME/bc-ipfs-example | ||
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/bc-ipfs $HOME/ | ||
|
||
# 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 && \ | ||
make install_unsupported ; \ | ||
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 $HOME/bc-ipfs-example | ||
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/* | ||
|
||
ENV IPFS_VERSION=0.4.15 \ | ||
IPFS_SHA256=48a81cfc34d3a12c8563dbdfae8681be6e4d23c0664d6a192bc2758c4e4ef377 | ||
|
||
USER $IPFS_UID | ||
|
||
|
@@ -58,7 +103,11 @@ RUN mkdir $HOME/bin && \ | |
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
&& ln -s $HOME/node_modules/dat/bin/cli.js $HOME/bin/dat | ||
&& ln -s $HOME/node_modules/dat/bin/cli.js $HOME/bin/dat ; | ||
|
||
COPY ./bin/*.sh $HOME/bin/ | ||
|
||
CMD ["/home/ipfsuser/bin/launch.sh"] | ||
|
||
EXPOSE 3000 | ||
|
||
|
@@ -68,3 +117,5 @@ EXPOSE 4002/udp | |
EXPOSE 5001 | ||
EXPOSE 8080 | ||
EXPOSE 8081 | ||
# Geth ports | ||
EXPOSE 8545 8546 30303 30303/udp |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ RUN mkdir $HOME/bin && \ | |
[email protected] \ | ||
[email protected] \ | ||
[email protected] \ | ||
[email protected].1 \ | ||
[email protected].4 \ | ||
[email protected] \ | ||
&& ln -s $HOME/node_modules/dat/bin/cli.js $HOME/bin/dat | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -a | ||
source /etc/profile.d/go_path.sh | ||
|
||
ipfs init | ||
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080 | ||
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001 | ||
# See https://github.com/ipfs/js-ipfs-api#cors for more refining policies on | ||
# acceptable URLs (CORS = Cross Origin Resource Sharing) | ||
# The following policy creates SECURITY BREACH!!!!!!!!!! | ||
# TODO: Fix this | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]" | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "[\"true\"]" | ||
ipfs daemon & | ||
|
||
set +a | ||
|
||
cd $HOME | ||
npm start |
This file contains 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