Skip to content

Commit

Permalink
Use symlink for bitmonero volume (#13)
Browse files Browse the repository at this point in the history
* Symlink `/opt/bitmonero` to `/home/monero/.bitmonero`
* Makes volume mounting cleaner
* Use `uname -m` to get CPU Architecture for build (maybe multi-arch
  builds in the future?)
  • Loading branch information
rblaine95 authored Jun 30, 2021
1 parent 644d061 commit 3552918
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
36 changes: 21 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
###################
# --- builder --- #
###################
FROM ghcr.io/rblaine95/debian:10-slim AS builder

# https://git.alpinelinux.org/aports/tree/testing/monero/APKBUILD
Expand All @@ -6,9 +9,9 @@ ARG MONERO_VERSION=0.17.2.0

WORKDIR /opt

RUN apt update && \
apt upgrade -y && \
apt install -y build-essential \
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y build-essential \
cmake pkg-config libboost-all-dev \
libssl-dev libzmq3-dev libunbound-dev \
libsodium-dev libunwind8-dev liblzma-dev \
Expand All @@ -21,29 +24,32 @@ RUN apt update && \
RUN git clone --recursive https://github.com/monero-project/monero.git -b v${MONERO_VERSION}

RUN cd monero && \
make -j2 release-static-linux-x86_64
make -j2 release-static-linux-$(uname -m)

##################
# --- runner --- #
##################
FROM ghcr.io/rblaine95/debian:10-slim

ENV PATH=/opt/monero:${PATH}

RUN apt update && \
apt upgrade -y && \
apt install -y ca-certificates libkrb5-dev && \
apt clean && \
apt autoremove -y && \
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y ca-certificates libkrb5-dev && \
apt-get clean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt && \
useradd -ms /bin/bash monero && \
mkdir -p /home/monero/.bitmonero && \
chown -R monero:monero /home/monero/.bitmonero
mkdir /opt/bitmonero && \
ln -s /opt/bitmonero /home/monero/.bitmonero && \
chown -R monero:monero /home/monero/.bitmonero && \
chown -R monero:monero /opt/bitmonero

COPY --from=builder /opt/monero/build/Linux/_no_branch_/release/bin/* /opt/monero/

USER monero

WORKDIR /home/monero

VOLUME /home/monero/.bitmonero

VOLUME /opt/bitmonero
EXPOSE 18080 18081

ENTRYPOINT ["/opt/monero/monerod"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ docker run \
--restart=always \
--net=host \
--name=monerod \
-v /path/to/bitmonero:/home/monero/.bitmonero \
-v /path/to/bitmonero:/opt/bitmonero \
ghcr.io/rblaine95/monero ${EXTRA_MONEROD_ARGS}
```

Expand Down

0 comments on commit 3552918

Please sign in to comment.