diff --git a/docker/Dockerfile b/docker/Dockerfile index 417dd35..b3241af 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 @@ -28,14 +23,11 @@ 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 RUN chmod +x /entrypoint.sh -USER bitcoin -WORKDIR /home/bitcoin - ENTRYPOINT ["/entrypoint.sh"] CMD ["bitcoind", "-regtest"] \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 5f55480..1af35e3 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,9 +1,6 @@ #!/bin/bash set -e -cp /etc/bitcoin.conf "$BITCOIN_DATA/bitcoin.conf" -chown -R bitcoin:bitcoin ${BITCOIN_DATA} \ - && chmod 755 ${BITCOIN_DATA} \ - && chmod 600 ${BITCOIN_DATA}/bitcoin.conf + cp /etc/bitcoin.conf /root/.bitcoin/bitcoin.conf \ exec "$@" \ No newline at end of file diff --git a/src/bin/bitbrew.ts b/src/bin/bitbrew.ts index 4ea2e9f..c762711 100644 --- a/src/bin/bitbrew.ts +++ b/src/bin/bitbrew.ts @@ -1,4 +1,4 @@ -#!/usr/bin/env node --no-warnings +#!/usr/bin/env -S node --no-warnings import { Command } from 'commander'; import figlet from 'figlet'; import chalk from 'chalk'; @@ -44,12 +44,12 @@ program.addCommand(LsCommand); program.addCommand(StartCommand); program.addCommand(StopCommand); program.addCommand(AddCommand); -program.addCommand(CleanCommand); program.addCommand(RemoveCommand); program.addCommand(ExecCommand); program.addCommand(AttachCommand); program.addCommand(WalletCommand); program.addCommand(SendCommand); program.addCommand(MineCommand); +program.addCommand(CleanCommand); program.parse(process.argv); diff --git a/src/controllers/nodeController.ts b/src/controllers/nodeController.ts index b32f58f..018bbe5 100644 --- a/src/controllers/nodeController.ts +++ b/src/controllers/nodeController.ts @@ -19,7 +19,7 @@ export class NodeController { fs.mkdirSync(node.dataDir, { recursive: true }); } - const imageName = `rishkwal/bitbrew-bitcoin-core:27.0-0.1.0-alpha`; + const imageName = `rishkwal/bitbrew-bitcoind:27.0-0.1.0-alpha`; let images = await this.dockerController.docker.listImages({ filters: { reference: [imageName] }, }); @@ -81,8 +81,8 @@ export class NodeController { }, HostConfig: { Binds: [ - `${node.dataDir}:/home/bitcoin/.bitcoin`, - `${this.stateController.getWalletsDir()}:/home/bitcoin/.bitcoin/regtest/wallets`, + `${node.dataDir}:/root/.bitcoin`, + `${this.stateController.getWalletsDir()}:/root/.bitcoin/regtest/wallets`, ], PortBindings: { '18444/tcp': [{ HostPort: node.hostPort.toString() }],