yamlapi docker映象
阿新 • • 發佈:2020-06-08
一、目錄結構:
pip.conf檔案:
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
requirements.txt檔案:
requests>=2.23.0
ddt>=1.4.1
PyMySQL>=0.9.3
DBUtils>=1.3
BeautifulReport>=0.1.2
demjson>=2.2.4
loguru>=0.5.0
PyYAML>=5.3.1
ruamel.yaml>=0.16.10
pytest>=5.4.2
pytest-html>=2.1.1
allure-pytest>=2.8.16
pytest-reportlog>=0.1.1
pytest-assume>=2.2.1
pytest-rerunfailures>=9.0
pytest-sugar>=0.9.3
pytest-timeout>=1.3.4
pytest-parallel>=0.1.0
psycopg2-binary==2.8.5
Dockerfile檔案:
FROM python:3.6.9
# 基礎映象
MAINTAINER yangjianliang <[email protected]>
# 作者
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
apt-get install -y \
tzdata
# 設定時區
COPY pip.conf /root/.pip/pip.conf
COPY requirements.txt /home/
# 複製配置檔案
RUN pip install -r /home/requirements.txt
# 安裝python依賴庫
ENV PYTHONUNBUFFERED=1
# 設定環境變數,不緩衝,等同於python -u
ENV LANGUAGE C.UTF-8
ENV LC_ALL C.UTF-8
# 設定環境變數,選擇C.UTF-8作為預設字符集,用以支援中文
二、打包映象:
docker build -t yamlapi .
三、推送到阿里雲映象倉庫
sudo docker login --username=yangjianliang2017 registry.cn-hangzhou.aliyuncs.com
登入阿里雲Docker Registry
sudo docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/yangjianliang/yamlapi:[映象版本號]
給本地映象打tag
sudo docker push registry.cn-hangzhou.aliyuncs.com/yangjianliang/yamlapi:[映象版本號]
推送到阿里雲映象倉庫
sudo docker pull registry.cn-hangzhou.aliyuncs.com/yangjianliang/yamlapi:[映象版本號]
從Registry中拉取映象
四、從阿里雲後臺管理介面搜尋映象: