diff --git a/tfgrid3/btcnode/Dockerfile b/tfgrid3/btcnode/Dockerfile index 8120cd21..c24372a5 100644 --- a/tfgrid3/btcnode/Dockerfile +++ b/tfgrid3/btcnode/Dockerfile @@ -1,18 +1,14 @@ -FROM ubuntu:latest +FROM ubuntu:24.04 ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y wget software-properties-common curl openssh-server ufw +RUN apt update && apt install -y wget software-properties-common curl ssh ufw # Download and install latest zinit -RUN curl -s https://api.github.com/repos/threefoldtech/zinit/releases/latest | \ - grep "browser_download_url" | \ - cut -d '"' -f 4 | \ - wget -qi - -O /sbin/zinit +RUN wget --progress=bar:force:noscroll -O /sbin/zinit https://github.com/threefoldtech/zinit/releases/download/v0.2.14/zinit && \ + chmod +x /sbin/zinit -RUN chmod +x /sbin/zinit COPY scripts/ufw.sh /usr/local/bin/ +COPY scripts/ssh-init.sh /usr/local/bin/ # Adding zinit config files ADD zinit /etc/zinit/ @@ -23,17 +19,13 @@ RUN latest_release=$(curl -s https://api.github.com/repos/bitcoin/bitcoin/releas tar -xzf bitcoin-${latest_release}-x86_64-linux-gnu.tar.gz && \ install -m 0755 -o root -g root -t /usr/local/bin bitcoin-${latest_release}/bin/* -# Install latest myceilum -RUN mycelium_version=$(curl -s https://api.github.com/repos/threefoldtech/mycelium/releases/latest | grep 'tag_name' | cut -d '"' -f 4 ) && \ - wget "https://github.com/threefoldtech/mycelium/releases/download/${mycelium_version}/mycelium-x86_64-unknown-linux-musl.tar.gz" && \ - tar -xzf mycelium-x86_64-unknown-linux-musl.tar.gz -C /usr/local/bin/ -ENV PATH="/usr/local/bin:${PATH}" - # Cleaning up -RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* mycelium-x86_64-unknown-linux-musl.tar.gz bitcoin-* +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* bitcoin-* # Copy the bitcoin.conf file to the container COPY bitcoin.conf /root/.bitcoin/bitcoin.conf # Starting Command to run Bitcoind and ssh +RUN chmod +x /sbin/zinit && chmod +x /usr/local/bin/ufw.sh && chmod +x /usr/local/bin/ssh-init.sh CMD ["/sbin/zinit", "init", "--container"] +#ENTRYPOINT ["zinit", "init"] diff --git a/tfgrid3/btcnode/scripts/ssh-init.sh b/tfgrid3/btcnode/scripts/ssh-init.sh new file mode 100644 index 00000000..8b1212f1 --- /dev/null +++ b/tfgrid3/btcnode/scripts/ssh-init.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -x + +if [ ! -z "$SSH_KEY" ]; then + mkdir -p /var/run/sshd +fi diff --git a/tfgrid3/btcnode/zinit/ssh_config.yaml b/tfgrid3/btcnode/zinit/ssh_config.yaml index 6e497a76..f2f20b42 100644 --- a/tfgrid3/btcnode/zinit/ssh_config.yaml +++ b/tfgrid3/btcnode/zinit/ssh_config.yaml @@ -1,10 +1,2 @@ -exec: /bin/sh -eux -c " - mkdir -p /var/run/sshd; - mkdir -p /root/.ssh/; - chmod 600 ~/.ssh; - chmod 600 /etc/ssh/*; - touch ~/.ssh/authorized_keys; - chmod 600 ~/.ssh/authorized_keys; - echo $SSH_KEY > /root/.ssh/authorized_keys; - echo 'ssh configred'" -oneshot: true \ No newline at end of file +exec: /usr/local/bin/ssh-init.sh +oneshot: true diff --git a/tfgrid3/btcnode/zinit/sshd.yaml b/tfgrid3/btcnode/zinit/sshd.yaml index 981d4d1e..898d8695 100644 --- a/tfgrid3/btcnode/zinit/sshd.yaml +++ b/tfgrid3/btcnode/zinit/sshd.yaml @@ -1,5 +1,3 @@ -exec: /bin/bash -c " set -x ; - /usr/sbin/sshd;" -test: /bin/bash -c "service ssh status" -after: - - ssh_config \ No newline at end of file +exec: /usr/sbin/sshd -D +after: + - ssh_config diff --git a/tfgrid3/btcnode/zinit/ufw_init.yaml b/tfgrid3/btcnode/zinit/ufw_init.yaml index 500d7e09..e8b852a9 100644 --- a/tfgrid3/btcnode/zinit/ufw_init.yaml +++ b/tfgrid3/btcnode/zinit/ufw_init.yaml @@ -1,4 +1,3 @@ -exec: /bin/sh -eux -c " - chmod +x /usr/local/bin/ufw.sh; - /usr/local/bin/ufw.sh;" -oneshot: true \ No newline at end of file +exec: /usr/local/bin/ufw.sh +log: stdout +oneshot: true