Last updated 4 years ago
Was this helpful?
cd
ls
cd iris
gedit Dockerfile &
FROM nitincypher/docker-ubuntu-python-pip COPY ./requirements.txt /app/requirements.txt WORKDIR /app RUN pip install -r requirements.txt COPY server.py /app COPY train_model.py /app CMD python /app/train_model.py && python /app/server.py
gedit requirements.txt
flask sklearn
docker build -t iris:1.0 .
docker run -itd --name iris iris:1.0
cat server.py
docker run -itd --name iris2 -p 5000:5000 iris:1.0
cat client.py
python client.py
docker run -itd -p 5000:5000 iris:1.0
ssh-keygen
cd .ssh/
cat id_rsa.pub
.pub:公鑰 ( Public )
若用 windows 抓取 SSH,需將 cat 改為 type
ssh
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJ8ayNlaDXv2LZS6c2NBPjwPNtY4VO31nQMtmMDSDHMMX+eYL+2q5uFkknE8yFEi+DwgxHHv6nzNGGaDGFDBctIDa34mmDUxgTLL+E4HKOU+0IsVYi5B1QOwxGTzlp/gotP0WQCk6BhBXiPgVketAwpv/H9V2aOFUMXTFgKVhwqzI66otK7hsaMfv7WSc9VNJD/cY9dyVf5koCeWlp/yJ3ZBFQwhxTGFJ6y4mmZ6O5Se5+6XQILkEDuCn+MtSyVHVQOioLUCxKOuPuxEim7EFUo/T2pHQdfDEwCPaW5Qwqi9ZxlSohldRwjiAjg8SiIvbdwSkdEsSdvqYh/p6Varsj
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCz3g61/ISxtJAHD32EebKe99rCH+xNRQc564lSeTvsTcW0raVfkqAtlpF2C8ul/7XjluvIBoooxSYGMGpWRT5uQq0eRDjKmAeKQ7ch3ZYuWPD+8lTGELrQ0n+TbU1vUJXvJe2kemp0GhW8RdVlTfiXu/e9v25YPldf27Mpmm7xTdxVFebUruiL14wEQGAVNG0AWpA3SQtZxbh2k9Szd5HtWpc39xSOpXGg8nUkOaiusrxhT12fjMu79dtaAM0f9T6SjjCar9wE9UwbpFGhR1PH9MnH2s9TfVm0xzwX4vjyOx44pjThH4aKQWcUeYgcMp0r7J5oZAGV0d2zppXpEcv5
Git global setup
git config --global user.name "Anida-Huang"
git config --global user.email "xiaoji850312@gmail.com"
Push an existing folder
git init
git remote add origin git@gitlab.com:Anida-Huang/cloud-communication-iris.git
git add .
git commit -m "Initial commit"
git push -u origin master
InstallSimply download one of the binaries for your system:
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
Give it permissions to execute:
chmod +x /usr/local/bin/gitlab-runner
Create a GitLab CI user:
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
Install and run as service:
/usr/local/bin/gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
/usr/local/bin/gitlab-runner start
Running as unprivileged user
usermod -aG docker gitlab-runner
su - gitlab-runner
exit
CI/CD
gitlab-runner register
https://gitlab.com/
[token]
vm1
shell
gedit gitlab-ci.yml
stages: - deploy docker-deploy: stage: deploy script: - docker build -t iris . - if [ $(docker ps -aq --filter name=iris) ]; then docker rm -f iris; fi - docker run -d -p 5000:5000 --name iris iris tags: - vm2
git add gitlab-ci.yml
git commit -m "submit .gitlab-ci.yml"