使用docker在centos6容器里面build package

做了一个centos6的build image:

把image给Pull下来,然后运行容器:

$ docker run -it weli/centos6-for-build sh
sh-4.1#

这里面装好了rhpkg

安装配置过程如下:

$ wget http://download.devel.redhat.com/rel-eng/dist-git/rhel/rhpkg.repo
$ mv rhpkg.repo /etc/yum.repos.d/

修改rhpkg.repo,改成6Workstation

此外,这个容器里面创建好了一个weli的用户(注意要用你的红帽账号名字一致的用户名),创建账号过程如下:

$ adduser weli

切到创建的账号:

$ su - weli
[weli@d4ee2bab7af6 ~]$ pwd
/home/weli

使用rhpkgclone一个package试试看:

$ rhpkg clone curl

可以看到clone好了这个package,切换到所需branch:

[weli@d4ee2bab7af6 curl]$ git checkout jb-cs-httpd24-37-rhel-7
Branch jb-cs-httpd24-37-rhel-7 set up to track remote branch jb-cs-httpd24-37-rhel-7 from origin.
Switched to a new branch 'jb-cs-httpd24-37-rhel-7'
[weli@d4ee2bab7af6 curl]$

然后使用rhpkg srpm命令生成srpm包:

然后使用rpmbuild命令进行build试试看:

[weli@d4ee2bab7af6 curl]$ rpmbuild --rebuild curl-7.61.1-1.jbcs.el7.src.rpm

Build过程截取如下:

耐心等待build完成:

以上就是使用容器进行centos/rhel的package build的过程介绍。

My Github Page: https://github.com/liweinan

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues