Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Build RPM package uses Docker mirror     - Development environment to build MEAN In Ubuntu 15.10 (Server)

- Linux Mint under tty.js Installation Guide (Linux)

- Ubuntu install code editor Sublime Text 3 (Linux)

- Terminal fun: 6 interesting Linux command-line tools (Linux)

- Install Linux Mint 17: 20 things to do (Linux)

- MNIST presentation and database conversion (Database)

- Ubuntu 14.04 + xRDP + Xfce implement Windows Remote Desktop Connection (Linux)

- Port is not being used, how will bind failure? (Server)

- Implement binary search algorithm in C language (Programming)

- numpy and SciPy installation under Python for scientific computing package (Linux)

- PL / SQL -> UTL_FILE use presentation package (Database)

- WordPress blog installation Redis Cache (Server)

- Alternative methods of intrusion bundled executable file new thinking (Linux)

- printf PHP string operations () built-in function usage (Programming)

- CentOS 6.x and CentOS7 installation RPMforge (Linux)

- Linux tmux tcpdump summary (Linux)

- httpd-2.4 feature (Server)

- Three kinds of binary tree traversal recursive and iterative solution (Programming)

- Setting Lns firewall against ARP attacks (Linux)

- CentOS7 install JAVA notes (Linux)

  Build RPM package uses Docker mirror
  Add Date : 2017-08-31      
  RPM (Red Hat Package Manager) is used for the most common Linux distribution's package manager. Because it allows to distribute the compiled software, so users can only use a single command to install the software. The RPM package build rather cumbersome, and relatively high demands on the environment, the author describes how to use Docker can be applied multiple platforms to build RPM packages.

In an internal project, I have been thinking about how the non-CI tools / processes generate RPM package, I would like to manually generate RPM package, so I can test whether they can be properly installed and used for normal smoke test (Translator's Note: after the smoke test is a daily build is complete, the basic functions of the system perform a simple test. this test coverage emphasizes function, not the function of the correctness verified).

In our CI process, Docker regarded as a versatile hand, so I also wonder if the Docker image and RPM together. Ideally, allow integration with RPM Docker, so, create RPM package is actually in the process of building a Docker image. Basically,% prep section of the RPM package can be quickly constructed in a special Docker mirror, then will generate RPM package back to the host.

The advantage of this approach is that your RPM package is in a relatively closed environment and renewable built in, so you can quickly build RPM packages for other systems CentOS, Fedora, RHEL and so on.

I believe there are some other workarounds can also accomplish this work, such as chroot like. However, if such a package built mechanism (through chroot / Docker abstract art or other container from the system to complete the work package) in RPM, then I think it would be better.

Since my project is not yet complete, so I'm just my thoughts were validated: simple to build a mirror that contains dependent.

This is a version of the Python generated using the PBR project. First I generate a directory in the build tarball, then get generated version number, followed by modifying spec file version number, then start with a new tar package and spec file to build the mirror. Finally run the mirror, and mount the volume (Volume) to a local directory. When running the container start.sh script, run up to the mirror.

start.sh quite simple. After it builds good RPM packages as root, copy it to the next volume catalog, but also from a host will copy it to the output directory. I did not copy it or to update similar swift like object storage system, because I have to use it in CI, so we use a local copy of the file.

In SPECS / project.spec and SOURCES / * standard RPM packages required spec, source files and patch files. The only thing to do is to define% define_version macro and use it in the spec file. Here are some of my scripts.

Master script build.sh. It can be run from the CI.

#! / Bin / bashset -exf
PROJECT = myproject

CURDIR = $ (dirname $ (readlink -f $ 0))
TOPDIR = $ (git rev-parse --show-topklevel 2> / dev / null)

rm -rf $ {CURDIR} /. build / rpm
mkdir -p $ {CURDIR} /. build / rpm / {BUILD, SRPMS, SPECS, RPMS / noarch}
cp -r $ {CURDIR} / SOURCES $ {CURDIR} /. build / rpm

pushd $ {TOPDIR}> / dev / null
python setup.py sdist --dist-dir $ {CURDIR} /. build / rpm / SOURCES /
SALADIER_VERSION = $ (sed -n '/ ^ Version / {s /.* //; p}' $ {PROJECT} .egg-info / PKG-INFO)
popd> / dev / null

sed -e "s /% define _version. * /% define _version $ {SALADIER_VERSION} /" $ {CURDIR} / SPECS / $ {MYROJECT} .spec> \
        $ {CURDIR} /. Build / rpm / SPECS / $ {MYPROJECT} .spec

docker build -t chmouel / buildrpm $ {CURDIR}
docker run -v $ CURDIR / .build: / data -it chmouel / buildrpm

if [[-n $ {ARTIFACT_DIR}]]; then
    rm -rf $ {ARTIFACT_DIR} / rpm
    cp -a $ {CURDIR} /. build / output $ {ARTIFACT_DIR} / rpm

DockerFile, the Docker caches do some optimization:

FROM fedora: 21
MAINTAINER Chmouel Boudjnah < chmouel@enovance.com >

RUN yum -y groupinstall 'Development Tools'
RUN yum -y install fedora-packager
RUN yum -y install yum-utils

RUN yum -y install sudo
RUN sed -i.bak -n -e '/^Defaults.*requiretty/ {s / ^ / # /;};/^%wheel.*ALL$/ {s / ^ / # /;}; / ^ # .. * wheel * NOPASSWD / {s / ^ # [] * //;}; p '/ etc / sudoers

RUN yum install -y https://rdo.fedorapeople.org/rdo-release.rpm# This is an optimisation for caching, since using the auto generated one will # make docker always run the builddep steps since new file
ADD SPECS / project.spec / tmp /
RUN yum-builddep -y /tmp/project.spec

ADD bin / start.sh /start.sh

RUN useradd -s / bin / bash -G adm, wheel, systemd-journal -m rpm

WORKDIR / home / rpm
CMD /start.sh

ADD .build / rpm / / home / rpm / rpmbuild /
RUN chown -R rpm: / home / rpm

USER rpm

And running from the container start.sh script:

#! / Bin / bash # script run inside the container
rpmbuild -ba rpmbuild / SPECS / project.spec || exit 1 [[-d / data]] || exit 0

sudo rm -rf / data / output
sudo cp -a rpmbuild / RPMS / noarch / data / output

The script may not be in your direct environment, but at least let you know this idea.
- Why use Docker (Programming)
- Linux operating system security settings initial understanding (Linux)
- Executable file format Explanation under Linux (Linux)
- Oracle background processes daemons (Database)
- Examples of Python any parameters (Programming)
- Orionode source Linux Mint installation (Linux)
- Several configuration changes illustrate deployment of PHP (Server)
- Five programming fallacy (Programming)
- Depth understanding of C language (Programming)
- Java memory-mapped file MappedByteBuffer (Programming)
- Oracle Database Delete Delete million or more common method of heap table data (Database)
- CentOS6 5 Configure SSH password Free (Linux)
- Linux package manager - yum (Linux)
- Linux System Getting Started Learning: Using yum to download the RPM package without installing (Linux)
- MySQL in order by inaccurate results in problems and solutions (Database)
- ctop: monitor container performance Linux command line artifact (Linux)
- Archive log file size and redo log file size relationship (Database)
- 8 Docker knowledge you may not know (Server)
- C # Future: Method Contract (Programming)
- IP Security Policy is to learn how to prevent Ping and closed ports (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.