File tree Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,13 @@ RUN curl -s https://api.github.com/repos/threefoldtech/zinit/releases/latest | \
1313
1414RUN chmod +x /sbin/zinit
1515COPY scripts/ufw.sh /usr/local/bin/
16+ COPY scripts/tfrobot.sh /usr/local/bin/
1617
1718# Adding zinit config files
1819ADD zinit /etc/zinit/
1920
20- # Install latest tfrobot
21- RUN tfrobot_version=$(curl -s https://api.github.com/repos/threefoldtech/tfgrid-sdk-go/releases/latest | grep 'tag_name' | cut -d '"' -f 4 ) && \
22- wget "https://github.com/threefoldtech/tfgrid-sdk-go/releases/download/${tfrobot_version}/tfgrid-sdk-go_Linux_x86_64.tar.gz" && \
23- tar -xzf tfgrid-sdk-go_Linux_x86_64.tar.gz -C /usr/local/bin/
24-
2521# Cleaning up
26- RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* tfgrid-sdk-go_Linux_x86_64.tar.gz
22+ RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2723
2824# Starting Command
2925CMD ["/sbin/zinit" , "init" , "--container" ]
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Script to download the latest version of tfrobot if version was not passed as env variable
4+
5+ download_latest_tfrobot () {
6+ echo " No version provided, downloading the latest version..."
7+ tf_v=$( curl -s https://api.github.com/repos/threefoldtech/tfgrid-sdk-go/releases/latest | grep ' tag_name' | cut -d ' "' -f 4)
8+ echo " Downloading latest version: $tf_v "
9+ wget -O " Latest.tar.gz" " https://github.com/threefoldtech/tfgrid-sdk-go/releases/download/${tf_v} /tfgrid-sdk-go_Linux_x86_64.tar.gz"
10+ tar -xzf Latest.tar.gz -C /usr/local/bin/
11+ rm -rf /Latest.tar.gz
12+ echo " tfrobot version ${tf_v} installed successfully."
13+ }
14+
15+ # Check if a version was provided as an argument
16+ if [ -z " $1 " ]; then
17+ echo " No version argument provided."
18+ download_latest_tfrobot
19+ else
20+ tf_v=$1
21+ echo " Downloading specified version: ${tf_v} ..."
22+ wget -O " tfrobot_version.tar.gz" " https://github.com/threefoldtech/tfgrid-sdk-go/releases/download/${tf_v} /tfgrid-sdk-go_Linux_x86_64.tar.gz"
23+ tar -xzf tfrobot_version.tar.gz -C /usr/local/bin/
24+ rm -rf /tfrobot_version.tar.gz
25+ echo " tfrobot version ${tf_v} installed successfully."
26+ fi
Original file line number Diff line number Diff line change @@ -5,6 +5,5 @@ exec: /bin/sh -eux -c "
55 chmod 600 /etc/ssh/*;
66 touch ~/.ssh/authorized_keys;
77 chmod 600 ~/.ssh/authorized_keys;
8- echo $SSH_KEY > /root/.ssh/authorized_keys;
98 echo 'ssh configred'"
10- oneshot : true
9+ oneshot : true
Original file line number Diff line number Diff line change 1+ exec : /bin/sh -eux -c "
2+ chmod +x /usr/local/bin/tfrobot.sh;
3+ if [ -z ${tfrobot_version:-} ]; then
4+ bash tfrobot.sh;
5+ else
6+ bash tfrobot.sh $tfrobot_version;
7+ fi"
8+ oneshot : true
You can’t perform that action at this time.
0 commit comments