20201027 資料卷與網路 (二)
課堂資料
Install GitLab Runner manually on GNU/Linux:
課堂練習
鳶尾花





GitLab SSH Keys 生成


GitLab
Last updated







Last updated
cdlscd irislsgedit 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.pygedit requirements.txtflask
sklearndocker build -t iris:1.0 .docker run -itd --name iris iris:1.0cat server.pydocker run -itd --name iris2 -p 5000:5000 iris:1.0lscat client.pypython client.pydocker build -t iris:1.0 .docker run -itd -p 5000:5000 iris:1.0cdssh-keygencd .ssh/cat id_rsa.pubssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJ8ayNlaDXv2LZS6c2NBPjwPNtY4VO31nQMtmMDSDHMMX+eYL+2q5uFkknE8yFEi+DwgxHHv6nzNGGaDGFDBctIDa34mmDUxgTLL+E4HKOU+0IsVYi5B1QOwxGTzlp/gotP0WQCk6BhBXiPgVketAwpv/H9V2aOFUMXTFgKVhwqzI66otK7hsaMfv7WSc9VNJD/cY9dyVf5koCeWlp/yJ3ZBFQwhxTGFJ6y4mmZ6O5Se5+6XQILkEDuCn+MtSyVHVQOioLUCxKOuPuxEim7EFUo/T2pHQdfDEwCPaW5Qwqi9ZxlSohldRwjiAjg8SiIvbdwSkdEsSdvqYh/p6Varsjcdcdssh-keygencd .ssh/cat id_rsa.pubssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCz3g61/ISxtJAHD32EebKe99rCH+xNRQc564lSeTvsTcW0raVfkqAtlpF2C8ul/7XjluvIBoooxSYGMGpWRT5uQq0eRDjKmAeKQ7ch3ZYuWPD+8lTGELrQ0n+TbU1vUJXvJe2kemp0GhW8RdVlTfiXu/e9v25YPldf27Mpmm7xTdxVFebUruiL14wEQGAVNG0AWpA3SQtZxbh2k9Szd5HtWpc39xSOpXGg8nUkOaiusrxhT12fjMu79dtaAM0f9T6SjjCar9wE9UwbpFGhR1PH9MnH2s9TfVm0xzwX4vjyOx44pjThH4aKQWcUeYgcMp0r7J5oZAGV0d2zppXpEcv5git config --global user.name "Anida-Huang"git config --global user.email "xiaoji850312@gmail.com"cd irisgit initgit remote add origin git@gitlab.com:Anida-Huang/cloud-communication-iris.gitgit add .git commit -m "Initial commit"git push -u origin mastersudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64chmod +x /usr/local/bin/gitlab-runneruseradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash/usr/local/bin/gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner/usr/local/bin/gitlab-runner startusermod -aG docker gitlab-runnersu - gitlab-runnerexitcdgitlab-runner registerhttps://gitlab.com/[token]vm1vm1shellcd irisgedit gitlab-ci.ymlstages:
- 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:
- vm2git add gitlab-ci.ymlgit commit -m "submit .gitlab-ci.yml"git push -u origin master