none commited on
Commit
e310801
·
1 Parent(s): 500cbfa

add cloudflared tunnel

Browse files
Files changed (3) hide show
  1. CFTOKEN.enc +5 -0
  2. Dockerfile +6 -5
  3. start.sh +11 -0
CFTOKEN.enc ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ U2FsdGVkX1/zLPdWdz9pp2O89Fd2qiGq6MAStpezbFJ/5d/XE2RNNA2N2CnVc7BQ
2
+ 9qUWzG1EvonXk9GSGYAc5Sev2VnOjGh5eDQsjOGHUlGPEvxX1D4UE5+WmU9+S5DK
3
+ tZxAetVkyIDQga/ZosPi6vDezEreOjMOtjkfG3UeJclAVM0ywAnfzeB/wJfXy2Yu
4
+ lWOzFnRrv/2OoS71C25cXjsflUbmm97SXNMUokjFwIyxdzK4T8uEj5rFHHMVhpyK
5
+ BApA5U9ydF6swFx7QNiIjg==
Dockerfile CHANGED
@@ -1,13 +1,13 @@
1
- # build with: docker build . --tag sctg/roco-idefics3:0.0.13 --tag sctg/roco-idefics3:latest --push
2
  # run with
3
- # docker run --gpus all --user=42420:42420 -p 7000-8000:7000-8000 -p 8080:8080 -e HF_TOKEN=hf_TOKEN -it sctg/roco-idefics3:0.0.13 bash -i /start.sh sleep infinity
4
- # docker run --gpus all --user=42420:42420 -p 7000-8000:7000-8000 -p 8080:8080 -it sctg/roco-idefics3:0.0.13 bash -i /start.sh python /learn.py hf_...
5
  FROM cloudflare/cloudflared:latest as cloudflared
6
  FROM nvidia/cuda:11.6.1-devel-ubuntu20.04
7
  ARG NODE_MAJOR="20"
8
  RUN /usr/sbin/addgroup --gid 42420 ovh
9
  RUN /usr/sbin/useradd -u 42420 --gid 42420 -m -d /workspace -s /bin/bash ovh
10
- RUN apt update -y && apt-get install -y curl git git-lfs screen \
11
  && mkdir -p /etc/apt/keyrings \
12
  && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
13
  && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
@@ -18,6 +18,7 @@ COPY learn.py /learn.py
18
  # Mandatory to run the jobs in rootless mode
19
  USER root
20
  RUN chown -R 42420:42420 /workspace
 
21
  COPY --from=cloudflared /usr/local/bin/cloudflared /usr/local/bin/cloudflared
22
  USER 42420
23
  RUN curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > /workspace/miniconda.sh
@@ -40,11 +41,11 @@ RUN . /workspace/.miniconda3/bin/activate \
40
  && pip uninstall unsloth -y \
41
  && pip install --upgrade --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git
42
 
43
-
44
  RUN . /workspace/.miniconda3/bin/activate && conda install -y jupyter
45
  RUN rm -f /workspace/miniconda.sh
46
  RUN mkdir -p /workspace/.config/github-copilot/
47
  COPY apps.json.enc /workspace/.config/github-copilot/apps.json.enc
 
48
  # Mandatory to run the jobs in rootless mode
49
  # USER root
50
  # RUN chown -R 42420:42420 /workspace
 
1
+ # build with: docker build . --tag sctg/roco-idefics3:0.0.14 --tag sctg/roco-idefics3:latest --push
2
  # run with
3
+ # docker run --gpus all --user=42420:42420 -p 7000-8000:7000-8000 -p 8080:8080 -e HF_TOKEN=hf_TOKEN -it sctg/roco-idefics3:0.0.14 bash -i /start.sh sleep infinity
4
+ # docker run --gpus all --user=42420:42420 -p 7000-8000:7000-8000 -p 8080:8080 -it sctg/roco-idefics3:0.0.14 bash -i /start.sh python /learn.py hf_...
5
  FROM cloudflare/cloudflared:latest as cloudflared
6
  FROM nvidia/cuda:11.6.1-devel-ubuntu20.04
7
  ARG NODE_MAJOR="20"
8
  RUN /usr/sbin/addgroup --gid 42420 ovh
9
  RUN /usr/sbin/useradd -u 42420 --gid 42420 -m -d /workspace -s /bin/bash ovh
10
+ RUN apt update -y && apt-get install -y curl git git-lfs screen sudo \
11
  && mkdir -p /etc/apt/keyrings \
12
  && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
13
  && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
 
18
  # Mandatory to run the jobs in rootless mode
19
  USER root
20
  RUN chown -R 42420:42420 /workspace
21
+ RUN echo "ovh ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
22
  COPY --from=cloudflared /usr/local/bin/cloudflared /usr/local/bin/cloudflared
23
  USER 42420
24
  RUN curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > /workspace/miniconda.sh
 
41
  && pip uninstall unsloth -y \
42
  && pip install --upgrade --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git
43
 
 
44
  RUN . /workspace/.miniconda3/bin/activate && conda install -y jupyter
45
  RUN rm -f /workspace/miniconda.sh
46
  RUN mkdir -p /workspace/.config/github-copilot/
47
  COPY apps.json.enc /workspace/.config/github-copilot/apps.json.enc
48
+ COPY CFTOKEN.enc /workspace/.config/CFTOKEN.enc
49
  # Mandatory to run the jobs in rootless mode
50
  # USER root
51
  # RUN chown -R 42420:42420 /workspace
start.sh CHANGED
@@ -24,6 +24,17 @@ if [ -f /workspace/.config/github-copilot/apps.json.enc ]; then
24
  openssl aes-256-cbc -a -d -md sha256 -pass pass:"$HF_TOKEN" -in /workspace/.config/github-copilot/apps.json.enc -out /workspace/.config/github-copilot/apps.json
25
  fi
26
 
 
 
 
 
 
 
 
 
 
 
 
27
  git clone https://huggingface.co/eltorio/IDEFICS3_ROCOv2
28
  git config --global user.email "[email protected]"
29
  git config --global user.name "[email protected]"
 
24
  openssl aes-256-cbc -a -d -md sha256 -pass pass:"$HF_TOKEN" -in /workspace/.config/github-copilot/apps.json.enc -out /workspace/.config/github-copilot/apps.json
25
  fi
26
 
27
+ # Launch cloudflared tunnel
28
+ # CFTOKEN.enc is the Cloudflared encrypted token
29
+ # CFTOKEN.enc contained an encrypted string encrypted with the HF_TOKEN
30
+ if [ -f /workspace/.config/CFTOKEN.enc ]; then
31
+ echo "Decrypting CFTOKEN"
32
+ CFTOKEN_ENC=$(cat /workspace/.config/CFTOKEN.enc)
33
+ echo "$CFTOKEN_ENC" | openssl aes-256-cbc -a -d -md sha256 -pass pass:"$HF_TOKEN" > /workspace/.config/cftoken
34
+ export CFTOKEN=$(cat /workspace/.config/cftoken)
35
+ /usr/local/bin/cloudflared --pidfile /tmp/$name.pid --autoupdate-freq 24h0m0s tunnel run --token $CFTOKEN &
36
+ fi
37
+
38
  git clone https://huggingface.co/eltorio/IDEFICS3_ROCOv2
39
  git config --global user.email "[email protected]"
40
  git config --global user.name "[email protected]"