Skip to content

Commit

Permalink
Symlink /data for cleaner persist (#1)
Browse files Browse the repository at this point in the history
* Expose ports (`30333`, `9933`, `9944`)
* Use symlink to make volume mounting/persistence cleaner
  • Loading branch information
rblaine95 authored Jun 26, 2021
1 parent 51f8130 commit f471488
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
###################
# --- builder --- #
###################
FROM ghcr.io/rblaine95/rust AS builder

ARG VERSION=0.9.7
Expand All @@ -13,6 +16,9 @@ RUN git clone https://github.com/paritytech/polkadot.git -b v$VERSION && \
./scripts/init.sh && \
cargo build --release

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

RUN apt-get update && \
Expand All @@ -21,15 +27,16 @@ RUN apt-get update && \
apt-get autoremove -y && \
rm -rf /var/lib/apt && \
useradd -ms /bin/bash dot && \
mkdir -p /home/dot/.local/share/polkadot && \
chown -R dot:dot /home/dot/.local/share/polkadot
mkdir -p /home/dot/.local/share /data && \
ln -s /data /home/dot/.local/share/polkadot && \
chown -R dot:dot /home/dot/.local/share && \
chown -R dot:dot /data

COPY --from=builder /opt/polkadot/target/release/polkadot /usr/local/bin/polkadot

USER dot

WORKDIR /home/dot

VOLUME /home/dot/.local/share/polkadot
EXPOSE 30333 9933 9944
VOLUME /data

ENTRYPOINT [ "/usr/local/bin/polkadot" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ docker run \
--restart=always \
--net=host \
--name=polkadot \
-v /path/to/polkadot:/home/dot/.local/share/polkadot \
-v /path/to/polkadot:/data \
ghcr.io/rblaine95/polkadot ${EXTRA_POLKADOT_ARGS}
```

Expand Down

0 comments on commit f471488

Please sign in to comment.