daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest May 16th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3.  
  4. build_image () {
  5.     pushd /tmp/stf_init
  6.    
  7.     if [[ -f Dockerfile ]]; then
  8.         rm -fr Dockerfile
  9.     fi
  10.    
  11.     docker pull docker.net.billing.ru/etp-cel/stf:0.0.1-SNAPSHOT
  12.  
  13.     touch Dockerfile
  14.     echo "ARG TESTEE=$1">>Dockerfile
  15.     echo "FROM docker.net.billing.ru/etp-cel/stf:0.0.1-SNAPSHOT">>Dockerfile
  16.  
  17.     docker build -t docker.net.billing.ru/etp-cell/$1:1.0.0 .
  18.  
  19.     popd
  20. }
  21.  
  22.  
  23. build_run_script() {
  24.    
  25.     pushd /tmp/stf_init
  26.    
  27.     echo Building stf script...
  28.    
  29.     touch stf
  30.     echo "#!/bin/bash">>stf
  31.     echo "docker run --rm -it docker.net.billing.ru/etp-cell/${1}:1.0.0">>stf
  32.  
  33.     chmod +x stf
  34.     mv ./stf /usr/bin/stf
  35.  
  36.     popd
  37.    
  38. }
  39.  
  40.  
  41. set -e
  42.  
  43. test -z "$1" && (echo 'Please enter your domain name'; exit 1)
  44.  
  45. testee_name=$1
  46.  
  47.  
  48. mkdir -p /tmp/stf_init/
  49.  
  50. build_image ${testee_name}
  51. build_run_script ${testee_name}
  52.  
  53. rm -fr /tmp/stf_init
RAW Paste Data
Top