条件:
gitlab准备好
jenkins准备好
(不会java项目, 故跳过Maven打jar包)
jenkins配置
在配置里通过插件Git Parameter配置Git,以便于从gitlab 拉去代码到Jenkins r容器内 /var/jenkins_home/
刚接触python 项目好像不需要构建,直接推送到远程服务器**/usr/local/test/**目录下,容器化启动
# 绝对地址(路径)
cd /usr/local/test/
docker compose -f docker-compose.yml down
docker rmi mytest:v1.0.0
docker compose -f docker-compose.yml up -d
gitlab-python项目
- 项目展示
- Dockerfile文件
FROM martinkaburu/python3.7-alpineWORKDIR /workspaceCOPY . ./RUN pip3 install --index https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip &&\pip3 install --index https://pypi.tuna.tsinghua.edu.cn/simple -r /workspace/requirements.txt --no-cache-dir && \chmod a+x /workspace/main.pyEXPOSE 8081CMD ["python3", "main.py"]
- docker-compose.yml
version: '3.1'
services:mytest:build:context: ./dockerfile: Dockerfileimage: mytest:v1.0.0container_name: mytestports:- '8081:8081'