自动化构建 Python 3.10 + Cloud Center
continuous-integration/drone/push Build is failing Details

main
lz-wang 2022-09-04 11:37:49 +08:00
parent aff6dae7d6
commit 15234f32b4
3 changed files with 103 additions and 4 deletions

View File

@ -1,7 +1,7 @@
---
kind: pipeline
type: ssh
name: 自动构建Python3.10镜像
name: 自动构建Docker镜像
server:
host:
@ -21,7 +21,8 @@ steps:
commands:
- docker ps
- docker images
- name: Build Docker Image
- name: Build Python 3.10
environment:
USERNAME:
from_secret: docker_hub_username
@ -29,6 +30,18 @@ steps:
from_secret: docker_hub_token
commands:
- echo $USERNAME
- docker build . -t lzwang/python3.10:nightly -f ./python3.10/Dockerfile
- docker build . -t $USERNAME/python3.10:nightly -f ./python3.10/Dockerfile
- docker login -u $USERNAME -p $TOKEN
- docker push lzwang/python3.10:nightly
- docker push $USERNAME/python3.10:nightly
- name: Build CloudCenter
environment:
USERNAME:
from_secret: docker_hub_username
TOKEN:
from_secret: docker_hub_token
commands:
- echo $USERNAME
- docker build . -t $USERNAME/cloud-center:nightly -f ./cloud-center/Dockerfile
- docker login -u $USERNAME -p $TOKEN
- docker push $USERNAME/cloud-center:nightly

70
cloud-center/Dockerfile Normal file
View File

@ -0,0 +1,70 @@
FROM python:3
# image info
LABEL Project="CloudCenter"
LABEL Author="lzwang"
LABEL Email="zhuangwang82@gmail.com"
LABEL Version=0.2
# setup volume
VOLUME /project
# setup workdir
WORKDIR /project
# setup mirrors of apt
# https://mirrors.tuna.tsinghua.edu.cn/help/debian/
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free" > /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free" >> /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list
# update apt packages
RUN apt-get update -y && apt-get upgrade -y \
&& apt-get install apt-utils -y \
&& rm -rf /var/lib/apt/lists/*
# install nodejs
# https://github.com/nodesource/distributions/blob/master/README.md#debinstall
RUN DEBIAN_FRONTEND=noninteractive \
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# setup nodejs
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org \
&& echo "alias npm=cnpm" >> /root/.bashrc \
&& npm config set registry https://registry.npm.taobao.org
# copy gitsh script
COPY ./gitsh /project/tools/gitsh
RUN chmod +x /project/tools/gitsh
# setup mirrors of pip
# https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# python pip install dependencies
COPY ./requirements.txt /project/requirements.txt
# redis must > 4.0 (ignore slowapi requirement)
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir redis==4.3.4 \
&& rm -rf /root/.cache \
&& rm -rf /tmp/*
# install packages
RUN apt-get update -y && apt-get upgrade -y \
&& apt-get install vim pngquant -y \
&& rm -rf /var/lib/apt/lists/*
# setup alias
RUN echo "alias ll='ls -la'" >> /root/.bashrc
# setup timezone
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& date
# on start up
CMD ["python3", "/project/CloudCenter/main.py"]

View File

@ -0,0 +1,16 @@
chardet>=4.0.0
cos-python-sdk-v5>=1.9.15
fastapi>=0.75.1
gitpython>=3.1.27
loguru>=0.6.0
matplotlib>=3.5.2
mkdocs>=1.3.0
mkdocs-material>=8.2.9
mkdocs-material-extensions>=1.0.3
pillow>=9.1.0
pydantic>=1.9.0
python-dateutil>=2.8.2
pyyaml>=6.0
requests>=2.28.0
slowapi>=0.1.5
uvicorn>=0.17.6