Skip to content

Commit

Permalink
fix(docker): use root user and directory changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rishkwal committed Jul 16, 2024
1 parent eea923f commit bc67ade
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
13 changes: 4 additions & 9 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
FROM debian:bullseye-slim

ARG UID=1000
ARG GID=1000
ENV BITCOIN_VERSION=27.0
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV PATH=/opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH

# Install dependencies and create bitcoin user
RUN apt-get update && apt-get install -y curl gnupg gosu \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& groupadd -g ${GID} bitcoin \
&& useradd -u ${UID} -g bitcoin -s /bin/bash -m -d /home/bitcoin bitcoin
# Install dependencies
RUN apt-get update && apt-get install -y curl gnupg \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Download and install Bitcoin Core
ARG TARGETPLATFORM
Expand All @@ -28,7 +23,7 @@ RUN set -ex \
# Copy Bitcoin configuration
COPY bitcoin.conf /etc/bitcoin.conf

VOLUME ["/home/bitcoin/.bitcoin"]
RUN mkdir -p /root/.bitcoin
EXPOSE 18443 18444

COPY entrypoint.sh /entrypoint.sh
Expand Down
6 changes: 1 addition & 5 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash
set -e

echo $(whoami)
cp /etc/bitcoin.conf "$BITCOIN_DATA/bitcoin.conf" \
&& mkdir /root/.bitcoin \
&& cp /etc/bitcoin.conf /root/.bitcoin/bitcoin.conf \
&& chmod 600 ${BITCOIN_DATA}/bitcoin.conf
cp /etc/bitcoin.conf /root/.bitcoin/bitcoin.conf \

exec "$@"

0 comments on commit bc67ade

Please sign in to comment.