mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 12:34:24 +00:00
Merge pull request #203 from djmaze/docker-integration
Add improved Dockerfile with wrapper script for seamless upgrades
This commit is contained in:
commit
e15a0b17bb
45
Dockerfile
45
Dockerfile
@ -1,34 +1,25 @@
|
|||||||
#
|
#
|
||||||
# Dockerfile for building Twister peer-to-peer micro-blogging
|
# Dockerfile for building Twister peer-to-peer micro-blogging
|
||||||
#
|
#
|
||||||
|
FROM ubuntu:14.04
|
||||||
|
|
||||||
FROM debian:testing
|
# Install twister-core
|
||||||
MAINTAINER Álvaro Justen <alvarojusten@gmail.com>
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y git autoconf libtool build-essential libboost-all-dev libssl-dev libdb++-dev libminiupnpc-dev && apt-get clean
|
||||||
|
#RUN git clone https://github.com/miguelfreitas/twister-core.git
|
||||||
|
ADD . /twister-core
|
||||||
|
RUN cd twister-core && \
|
||||||
|
./bootstrap.sh && \
|
||||||
|
make
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
# Install twister-html
|
||||||
|
RUN git clone https://github.com/miguelfreitas/twister-html.git /twister-html
|
||||||
|
|
||||||
# Update repositories
|
# Configure HOME directory
|
||||||
RUN echo 'deb http://http.debian.net/debian testing main contrib' > /etc/apt/sources.list
|
# and persist twister data directory as a volume
|
||||||
RUN echo 'deb http://http.debian.net/debian testing-updates main contrib' >> /etc/apt/sources.list
|
ENV HOME /root
|
||||||
RUN echo 'deb http://security.debian.org testing/updates main contrib' >> /etc/apt/sources.list
|
VOLUME /root/.twister
|
||||||
RUN apt-get update
|
|
||||||
|
|
||||||
# Install needed packages to build and run twisterd
|
# Run twisterd by default
|
||||||
RUN apt-get -y install \
|
ENTRYPOINT ["/twister-core/twisterd", "-rpcuser=user", "-rpcpassword=pwd", "-rpcallowip=172.17.42.1", "-htmldir=/twister-html", "-printtoconsole"]
|
||||||
git autoconf libtool build-essential \
|
EXPOSE 28332
|
||||||
libboost-all-dev libdb++-dev libminiupnpc-dev libssl-dev
|
|
||||||
|
|
||||||
# Clean APT cache to save disk space
|
|
||||||
RUN apt-get clean
|
|
||||||
|
|
||||||
# Download and build twister
|
|
||||||
RUN mkdir /root/.twister
|
|
||||||
RUN git clone https://github.com/miguelfreitas/twister-core.git /root/twister-core
|
|
||||||
RUN git clone https://github.com/miguelfreitas/twister-html.git /root/.twister/html
|
|
||||||
RUN cd /root/twister-core && ./bootstrap.sh
|
|
||||||
RUN cd /root/twister-core && make
|
|
||||||
|
|
||||||
EXPOSE 28332
|
|
||||||
ENTRYPOINT ["/root/twister-core/twisterd"]
|
|
||||||
CMD ["-rpcuser=user", "-rpcpassword=pwd", "-rpcallowip=*", \
|
|
||||||
"-datadir=/root/.twister", "-htmldir=/root/.twister/html"]
|
|
||||||
|
13
README.md
13
README.md
@ -28,12 +28,15 @@ Please follow the instructions for your platform:
|
|||||||
- [Mac OS X](https://github.com/miguelfreitas/twister-core/blob/master/doc/build-osx.md)
|
- [Mac OS X](https://github.com/miguelfreitas/twister-core/blob/master/doc/build-osx.md)
|
||||||
- [Windows (untested)](https://github.com/miguelfreitas/twister-core/wiki/Compiling-for-Windows)
|
- [Windows (untested)](https://github.com/miguelfreitas/twister-core/wiki/Compiling-for-Windows)
|
||||||
|
|
||||||
Or, alternatively, you can build Twister on an isolated Linux container, using
|
Or, alternatively, you can run Twister on an isolated Linux container, using [docker](http://docker.io/). Quickstart:
|
||||||
[docker](http://docker.io/):
|
|
||||||
|
|
||||||
docker build -t twister https://raw.githubusercontent.com/miguelfreitas/twister-core/master/Dockerfile
|
# Prepend "sudo -E" if you are not logged in as root
|
||||||
docker run -d -p 127.0.0.1:1234:28332 twister
|
./twister-on-docker run --remote
|
||||||
# now try to access http://127.0.0.1:1234/ on docker host
|
|
||||||
|
The above command downloads and runs a [pre-built image](https://index.docker.io/u/mazzolino/twister/) from the Docker index. You can also build and run your own container:
|
||||||
|
|
||||||
|
./twister-on-docker build
|
||||||
|
./twister-on-docker run
|
||||||
|
|
||||||
> According to our tests, at least 1GB of RAM is needed to compile Twister.
|
> According to our tests, at least 1GB of RAM is needed to compile Twister.
|
||||||
|
|
||||||
|
57
twister-on-docker
Executable file
57
twister-on-docker
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Build or run a docker image of twister
|
||||||
|
#
|
||||||
|
|
||||||
|
ACTION=${1:-run}
|
||||||
|
MODE=${2:---local}
|
||||||
|
|
||||||
|
IMAGE_NAME=twister
|
||||||
|
REMOTE_IMAGE_NAME=mazzolino/twister
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
shift
|
||||||
|
|
||||||
|
case $ACTION in
|
||||||
|
|
||||||
|
build)
|
||||||
|
echo Building $IMAGE_NAME
|
||||||
|
docker build -t $IMAGE_NAME .
|
||||||
|
;;
|
||||||
|
|
||||||
|
run)
|
||||||
|
if [ $MODE == "--remote" ]; then
|
||||||
|
shift
|
||||||
|
IMAGE_NAME=$REMOTE_IMAGE_NAME
|
||||||
|
echo Pulling new version of $IMAGE_NAME
|
||||||
|
docker pull $IMAGE_NAME
|
||||||
|
fi
|
||||||
|
echo Running $IMAGE_NAME
|
||||||
|
docker run -d -p 28332:28332 -v $HOME/.twister:/root/.twister $IMAGE_NAME "$@"
|
||||||
|
echo Twister should now be running at http://localhost:28332
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
CID=$(docker ps | grep twister | awk '{print $1}')
|
||||||
|
if [ "$CID" ]; then
|
||||||
|
echo Stopping container $CID
|
||||||
|
docker stop $CID
|
||||||
|
docker rm $CID
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo Usage:
|
||||||
|
echo " $0 run [ARGS FOR TWISTERD..]"
|
||||||
|
echo " Run twister from a local docker build (default)"
|
||||||
|
echo
|
||||||
|
echo " $0 run --remote [ARGS FOR TWISTERD..]"
|
||||||
|
echo " Run twister from the remote docker build at \"$REMOTE_IMAGE_NAME\""
|
||||||
|
echo
|
||||||
|
echo " $0 build"
|
||||||
|
echo " Build a local docker image for twister"
|
||||||
|
|
||||||
|
exit 2
|
||||||
|
|
||||||
|
esac
|
Loading…
x
Reference in New Issue
Block a user