Browse Source

bitcoind on alpine

Fabian Peter Hammerle 3 years ago
commit
88dd81ecbb
2 changed files with 38 additions and 0 deletions
  1. 15 0
      Dockerfile
  2. 23 0
      docker-compose.yml

+ 15 - 0
Dockerfile

@@ -0,0 +1,15 @@
+FROM alpine:3.12
+
+# > All command-line options (except for '-datadir' and '-conf') may be specified in a configuration file
+ENV DATA_DIR_PATH=/var/lib/bitcoin
+ARG BITCOIN_CORE_PACKAGE_VERSION=0.19.1-r0
+# > Executing bitcoin-0.19.1-r0.post-install
+# > Generated random user / password / port in: /etc/bitcoin.conf
+RUN apk add --no-cache bitcoin=$BITCOIN_CORE_PACKAGE_VERSION \
+    && rm /etc/bitcoin.conf \
+    && mkdir "$DATA_DIR_PATH" \
+    && chown -c bitcoin "$DATA_DIR_PATH"
+VOLUME $DATA_DIR_PATH
+
+USER bitcoin
+CMD ["sh", "-c", "exec bitcoind -datadir=\"$DATA_DIR_PATH\""]

+ 23 - 0
docker-compose.yml

@@ -0,0 +1,23 @@
+version: '2.3'
+
+volumes:
+  data:
+
+services:
+  bitcoind:
+    build: .
+    image: fphammerle/bitcoin-core
+    container_name: bitcoind
+    volumes:
+    - type: volume
+      source: data
+      target: /var/lib/bitcoin
+    read_only: yes
+    cap_drop: [ALL]
+    security_opt: [no-new-privileges]
+    cpus: 0.5
+    # > Memory cgroup out of memory: Killed process 430587 (bitcoind) total-vm:278720kB, [...]
+    mem_limit: 384m
+    restart: unless-stopped
+
+# https://docs.docker.com/compose/compose-file/compose-file-v2/