Skip to content

Commit

Permalink
Added Dockerfile and compose sample file.
Browse files Browse the repository at this point in the history
  • Loading branch information
moochannel committed Jan 15, 2019
1 parent ce2f2fb commit 967ebfd
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
@@ -0,0 +1,4 @@
.git
.github
Dockerfile
docker-compose.yml*
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -116,3 +116,6 @@ test/cache/*

libxpchainconsensus.pc
contrib/devtools/split-debug.sh

docker-compose.yml
docker-compose.override.yml
108 changes: 108 additions & 0 deletions Dockerfile
@@ -0,0 +1,108 @@
FROM ubuntu:bionic AS build

# Change APT source (Development purpose only)
# RUN \
# sed -i".bak" \
# "s@http://archive\.ubuntu\.com@http://ubuntu-ashisuto\.ubuntulinux\.jp/ubuntu@" \
# /etc/apt/sources.list

# Basic settings
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
apt-utils && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
language-pack-en tzdata software-properties-common && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
update-locale LANG=en_US.UTF-8

# Prepare for build xpchaind
RUN \
apt-add-repository ppa:bitcoin/bitcoin -y && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential libtool autotools-dev automake pkg-config libssl-dev \
libevent-dev bsdmainutils python3 libboost-system-dev \
libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev \
libboost-test-dev libboost-thread-dev libdb4.8-dev libdb4.8++-dev \
libminiupnpc-dev libzmq3-dev libunivalue-dev ca-certificates curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Build XPChaind
COPY . /usr/src/xpchain
WORKDIR /usr/src/xpchain
RUN \
./autogen.sh && \
./configure --without-gui && \
make -j$(nproc) && \
make install && \
make clean


FROM ubuntu:bionic

# Change APT source (Development purpose only)
# RUN \
# sed -i".bak" \
# "s@http://archive\.ubuntu\.com@http://ubuntu-ashisuto\.ubuntulinux\.jp/ubuntu@" \
# /etc/apt/sources.list

ENV \
XPCHAIND_DATA_DIR=/home/wallet/.xpchain

# Basic settings
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
apt-utils && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
language-pack-en tzdata software-properties-common gosu && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
update-locale LANG=en_US.UTF-8

# Create a normal user
RUN \
useradd -d /home/wallet -m -s /bin/bash wallet && \
gosu wallet mkdir ${XPCHAIND_DATA_DIR}

# Prepare for run xpchaind
RUN \
apt-add-repository ppa:bitcoin/bitcoin -y && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
libboost-chrono1.65.1 libboost-filesystem1.65.1 libboost-system1.65.1 \
libboost-test1.65.1 libboost-thread1.65.1 libc6 libdb4.8++ libevent-2.1-6 \
libevent-pthreads-2.1-6 libgcc1 libminiupnpc10 libnorm1 libpgm-5.2-0 \
libsodium23 libssl1.1 libstdc++6 libzmq5 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Copy build xpchaind (and other tools)
COPY --from=build \
/usr/local/bin/bench_bitcoin /usr/local/bin/test_bitcoin \
/usr/local/bin/xpchain-cli /usr/local/bin/xpchain-tx /usr/local/bin/xpchaind \
/usr/local/bin/

# Install debug tools (Development purpose only)
# RUN \
# apt-get update && \
# DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# vim sudo && \
# apt-get clean && \
# rm -rf /var/lib/apt/lists/* && \
# echo "wallet ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/wallet

# Place an entrypoint script (No need at this point)
# COPY docker-entrypoint.sh /
# RUN \
# chmod +x /docker-entrypoint.sh && \

USER wallet
WORKDIR /home/wallet
VOLUME ["${XPCHAIND_DATA_DIR}"]
EXPOSE 8798 18798
# ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/local/bin/xpchaind", "-printtoconsole", "-nodebuglogfile"]
18 changes: 18 additions & 0 deletions docker-compose.yml.sample
@@ -0,0 +1,18 @@
version: '2.3'
services:
wallet:
build:
context: .
image: xpchaind
ports:
- 8798:8798
- 18798:18798
volumes:
- wallet-data:/home/wallet/.xpchain
volumes:
wallet-data:
## Uncomment below to mount host's directory into container
# driver_opts:
# type: none
# device: /path/to/wallet-data
# o: bind

0 comments on commit 967ebfd

Please sign in to comment.