Skip to content

Commit

Permalink
add hero dockerfile & entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
timurgordon committed Jan 31, 2024
1 parent 721108e commit efcaeaa
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tfgrid3/hero/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:22.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive

# Update and install necessary packages
RUN apt-get update && apt-get install -y \
openssh-server \
build-essential \
curl \
git \
unzip \
vim \
libgc-dev \
make

# Install Golang
ENV GOLANG_VERSION 1.17
RUN curl -sSL "https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xz
ENV PATH="/usr/local/go/bin:${PATH}"

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Set Rust environment variables
ENV PATH="/root/.cargo/bin:${PATH}"

# Install myceilum
ENV MYCELIUM_VERSION v0.2.3
RUN curl -sSL "https://github.com/threefoldtech/mycelium/releases/download/${MYCELIUM_VERSION}/mycelium-x86_64-unknown-linux-musl.tar.gz" | tar -C /usr/local/bin/ -xz
ENV PATH="/usr/local/bin:${PATH}"

# Install hero
RUN curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/installer_hero.sh > /tmp/hero_install.sh
RUN bash /tmp/hero_install.sh
#to debug
RUN bash -x /tmp/hero_install.sh

# Copy entrypoint script
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENV PATH="/usr/local/go/bin:${PATH}"
RUN echo PATH=${PATH} >> /root/.bashrc

# Expose SSH port
EXPOSE 22

# Set the entry point to the custom script
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
13 changes: 13 additions & 0 deletions tfgrid3/hero/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Set SSH public key from environment variable
if [ -n "$SSH_KEY" ]; then
mkdir -p /root/.ssh
echo "$SSH_KEY" > /root/.ssh/authorized_keys
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
fi
mkdir -p /run/sshd

# Start the SSH server
exec /usr/sbin/sshd -D

0 comments on commit efcaeaa

Please sign in to comment.