fix and improve docker image, add doc for docker-compose

This commit is contained in:
Bruno Clermont 2017-11-17 12:14:19 +08:00
parent dc6a8014bd
commit e03be11a0e
3 changed files with 38 additions and 33 deletions

View File

@ -1 +0,0 @@
*

View File

@ -1,31 +1,40 @@
FROM ubuntu:16.04 # Multistage docker build, requires docker 17.05
ENV SRC_DIR /usr/local/src/monero # builder stage
FROM ubuntu:16.04 as builder
RUN set -x \ RUN apt-get update && \
&& buildDeps=' \ apt-get --no-install-recommends --yes install \
ca-certificates \ ca-certificates \
cmake \ cmake \
g++ \ g++ \
git \
libboost1.58-all-dev \ libboost1.58-all-dev \
libssl-dev \ libssl-dev \
libzmq3-dev \ libzmq-dev \
libsodium-dev \
make \ make \
pkg-config \ pkg-config \
' \ graphviz \
&& apt-get -qq update \ doxygen \
&& apt-get -qq --no-install-recommends install $buildDeps git
RUN git clone https://github.com/monero-project/monero.git $SRC_DIR WORKDIR /src
WORKDIR $SRC_DIR COPY . .
RUN make -j$(nproc) release-static RUN rm -rf build && \
qmake -j$(nproc) release-static
RUN cp build/release/bin/* /usr/local/bin/ \ # runtime stage
\ FROM ubuntu:16.04
&& rm -r $SRC_DIR \
&& apt-get -qq --auto-remove purge $buildDeps RUN apt-get update && \
apt-get --no-install-recommends --yes install \
ca-certificates \
libboost1.58-all \
libssl1.0.0 \
libzmq1 && \
apt-get clean && \
rm -rf /var/lib/apt
COPY --from=builder /src/build/release/bin/* /usr/local/bin/
# Contains the blockchain # Contains the blockchain
VOLUME /root/.bitmonero VOLUME /root/.bitmonero
@ -35,13 +44,7 @@ VOLUME /root/.bitmonero
# monero-wallet-cli # monero-wallet-cli
VOLUME /wallet VOLUME /wallet
ENV LOG_LEVEL 0
ENV P2P_BIND_IP 0.0.0.0
ENV P2P_BIND_PORT 18080
ENV RPC_BIND_IP 127.0.0.1
ENV RPC_BIND_PORT 18081
EXPOSE 18080 EXPOSE 18080
EXPOSE 18081 EXPOSE 18081
CMD monerod --log-level=$LOG_LEVEL --p2p-bind-ip=$P2P_BIND_IP --p2p-bind-port=$P2P_BIND_PORT --rpc-bind-ip=$RPC_BIND_IP --rpc-bind-port=$RPC_BIND_PORT ENTRYPOINT ["monerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=18080", "--rpc-bind-ip=127.0.0.1", "--rpc-bind-port=18081"]

View File

@ -144,6 +144,9 @@ Installing a snap is very quick. Snaps are secure. They are isolated with all of
# or in background # or in background
docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
**Warning** make sure to use `tty: true` with `docker-compose`, if `monerod` don't have a tty it will exit once it's initialized.
Packaging for your favorite distribution would be a welcome contribution! Packaging for your favorite distribution would be a welcome contribution!
## Compiling Monero from Source ## Compiling Monero from Source