Skip to content

Commit

Permalink
Merge pull request #1 from blcksync/master
Browse files Browse the repository at this point in the history
Syncing with upstream for latest features
  • Loading branch information
al-blockmed authored Sep 7, 2018
2 parents cfd6655 + 014af58 commit bac3bcb
Show file tree
Hide file tree
Showing 34 changed files with 10,980 additions and 0 deletions.
70 changes: 70 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
FROM go-node:latest

LABEL maintainer="matr1xc0in"

ENV SHELL=/bin/bash \
IPFS_USER=ipfsuser \
IPFS_UID=3888 \
IPFS_GID=4888
ENV HOME=/home/$IPFS_USER

USER root
WORKDIR /root

RUN apk update && apk upgrade && \
apk add --no-cache bash git \
python \
python-dev \
py-pip \
libtool \
build-base \
&& 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

ENV IPFS_VERSION=0.4.15 \
IPFS_SHA256=48a81cfc34d3a12c8563dbdfae8681be6e4d23c0664d6a192bc2758c4e4ef377

# 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

# add to image and unzip it
COPY ./bc-ipfs-example $HOME/bc-ipfs-example

# 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 ; \
chown -R $IPFS_UID:$IPFS_GID $HOME && \
chown -R $IPFS_UID:$IPFS_GID $HOME/bc-ipfs-example

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

EXPOSE 3000

# Ports for Swarm TCP, Swarm uTP, API, Gateway, Swarm Websockets
EXPOSE 4001
EXPOSE 4002/udp
EXPOSE 5001
EXPOSE 8080
EXPOSE 8081
50 changes: 50 additions & 0 deletions Dockerfile.alpine-node
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# https://hub.docker.com/_/alpine/
FROM alpine:3.7

ENV NODEJS_VERSION=8.11.3 \
NODEJS_SHA256=0d7e795c0579226c8b197353bbb9392cae802f4fefa4787a2c0e678beaf85cce \
NPM_VERSION=5.6.0

# latest node source code https://nodejs.org/en/download/

RUN info(){ printf '\n--\n%s\n--\n\n' "$*"; } \
&& info "==> Installing dependencies..." \
&& apk update \
&& apk add --no-cache --virtual build-deps \
curl make gcc g++ python paxctl \
musl-dev openssl-dev zlib-dev \
linux-headers binutils-gold \
&& mkdir -p /root/nodejs \
&& cd /root/nodejs \
&& info "==> Downloading..." \
&& curl -sSL -o node.tar.gz http://nodejs.org/dist/v${NODEJS_VERSION}/node-v${NODEJS_VERSION}.tar.gz \
&& echo "$NODEJS_SHA256 node.tar.gz" > node.sha256 \
&& sha256sum -c node.sha256 \
&& info "==> Extracting..." \
&& tar -xzf node.tar.gz \
&& cd node-* \
&& info "==> Configuring..." \
&& readonly NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1) \
&& echo "using upto $NPROC threads" \
&& ./configure \
--prefix=/usr \
--shared-openssl \
--shared-zlib \
&& info "==> Building..." \
&& make -j$NPROC -C out mksnapshot \
&& paxctl -c -m out/Release/mksnapshot \
&& make -j$NPROC \
&& info "==> Installing..." \
&& make install \
&& info "==> Finishing..." \
&& apk del build-deps \
&& apk add \
openssl libgcc libstdc++ \
&& rm -rf /var/cache/apk/* \
&& info "==> Updating NPM..." \
&& npm i -g npm@$NPM_VERSION \
&& info "==> Cleaning up..." \
&& npm cache clean --force \
&& rm -rf ~/.node-gyp /tmp/* \
&& rm -rf /root/nodejs \
&& echo 'Done! =)'
87 changes: 87 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
FROM go-node:latest as builder

WORKDIR /root

RUN 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

# 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

# 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

FROM 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/

# 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/*

ENV IPFS_VERSION=0.4.15 \
IPFS_SHA256=48a81cfc34d3a12c8563dbdfae8681be6e4d23c0664d6a192bc2758c4e4ef377

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

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
56 changes: 56 additions & 0 deletions Dockerfile.go-node
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
ARG ALPINE_IMAGE=alpine-node:latest
FROM $ALPINE_IMAGE
# https://hub.docker.com/_/alpine/

LABEL maintainer="matr1xc0in"

USER root

# Reference: https://github.com/docker-library/golang/blob/master/1.10/alpine3.7/Dockerfile
RUN apk add --no-cache \
bash ca-certificates \
&& [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf

ENV GOLANG_VERSION 1.10.3

RUN set -eux; \
apk add --no-cache --virtual .build-deps \
bash \
gcc \
musl-dev \
openssl \
go \
; \
export \
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
GOOS="$(go env GOOS)" \
GOARCH="$(go env GOARCH)" \
GOHOSTOS="$(go env GOHOSTOS)" \
GOHOSTARCH="$(go env GOHOSTARCH)" \
; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
armhf) export GOARM='6' ;; \
x86) export GO386='387' ;; \
esac; \
\
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
echo '567b1cc66c9704d1c019c50bef946272e911ec6baf244310f87f4e678be155f2 *go.tgz' | sha256sum -c -; \
tar -C /usr/local -xzf go.tgz; \
rm go.tgz; \
\
cd /usr/local/go/src; \
for p in /go-alpine-patches/*.patch; do [ -f "$p" ] || continue; patch -p2 -i "$p"; done; \
./make.bash; \
rm -rf /go-alpine-patches; \
apk del .build-deps; \
export PATH="/usr/local/go/bin:$PATH"; \
go version

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" \
&& echo "export PATH=/usr/local/go/bin:\$GOPATH/bin:\$PATH" > /etc/profile.d/go_path.sh

WORKDIR $GOPATH
12 changes: 12 additions & 0 deletions Dockerfile.ipfs-insecure
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ipfs/go-ipfs:v0.4.17

# This is a customized insecure config to open wide to the world
COPY ./ipfs-bin-container_daemon.sh /usr/local/bin/start_ipfs

# This just makes sure that:
# 1. There's an fs-repo, and initializes one if there isn't.
# 2. The API and Gateway are accessible from outside the container.
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/start_ipfs"]

# Execute the daemon subcommand by default
CMD ["daemon", "--migrate=true"]
40 changes: 40 additions & 0 deletions Dockerfile.qtum
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM qtum-dev:latest

LABEL maintainer="matr1xc0in"

ARG QTUM_UID

# UID is the only thing that matters
ENV SHELL=/bin/sh \
QTUM_USER=qtumuser \
QTUM_UID=${QTUM_UID} \
QTUM_GID=5888
ENV HOME=/home/$QTUM_USER
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

USER root

# Install go
# Install go-ipfs and gx
RUN apk add --no-cache go git make musl-dev && \
mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" && \
echo "export PATH=/usr/local/go/bin:\$GOPATH/bin:\$PATH:\$HOME/bin" > /etc/profile.d/go_path.sh && \
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

USER $QTUM_UID
WORKDIR $HOME

CMD ["/bin/sh", "-c", "mkdir -p $QTUM_DATADIR && goreman -f /Procfile start"]

EXPOSE 13888
EXPOSE 3888
EXPOSE 3889
EXPOSE 9888
EXPOSE 9899

EXPOSE 3000
EXPOSE 5001
EXPOSE 8080
Loading

0 comments on commit bac3bcb

Please sign in to comment.