Coder Social home page Coder Social logo

docker-rpmbuild's Introduction

docker-rpmbuild

A minimal docker rpmbuilder image.

Based on centos, includes only rpmdevtools and yum-utils and a couple of scripts that automate building RPM packages.

The scripts take care of installing build dependencies (using yum-builddep), building the package (using rpmbuild) and placing the resulting RPMs in output directory.

The setup is based on Fedora packaging how-to: http://fedoraproject.org/wiki/How_to_create_an_RPM_package

Supported tags and respective Dockerfile links

Usage

The image expects that work directory will be set to directory containing the sources (mounted from the host).

Typical usage:

docker run --rm --volume=$PWD:/src --workdir=/src \
  jitakirin/rpmbuild MYPROJ.spec

This will build the project MYPROJ in current directory, placing results in RPMS/${ARCH}/ and SRPMS/ subdirectories under current directory.

You can also specify to place the results in a subdirectory:

docker run --rm --volume=$PWD:/src --workdir=/src \
  jitakirin/rpmbuild MYPROJ.spec OUTDIR

This will create OUTDIR if necessary and place the results in OUTDIR/RPMS/${ARCH}/ and OUTDIR/SRPMS/.

If your package requires something from a non-core repo to build, you can add that repo using a PRE_BUILDDEP hook. It is an env variable that should contain an inline script or command to add the repo you need. E.g. for EPEL do:

docker run --rm --volume=$PWD:/src --workdir=/src \
  --env=PRE_BUILDDEP="yum install -y epel-release" \
  jitakirin/rpmbuild MYPROJ.spec

Debugging

There are two options to aid with debugging the build. One is to set VERBOSE option in the environment (with -e VERBOSE=1 option to docker run) which will enable verbose output from the scripts and rpmbuild. The other is to pass an --sh option to the image, which will drop to the shell instead of running rpmbuild, e.g.:

docker run -it -e VERBOSE=1 --rm --volume=$PWD:/src --workdir=/src \
  jitakirin/rpmbuild --sh MYPROJ.spec

From there you can inspect the environment and you can run the build manually either by switching to rpmbuild user:

su - rpmbuild
rpmbuild -ba rpmbuild/SPECS/MYPROJ.spec

or by running the same script the image uses:

runuser -u rpmbuild /usr/local/bin/docker-rpm-build.sh \
  ~rpmbuild/SPECS/MYPROJ.spec

Jenkins

To use this from a Jenkins builder which itself is running under docker (assuming it has access to host's docker socket), use something like:

docker run --rm \
  --volumes-from=JENKINS-VOLUME-CONTAINER --workdir="${WORKSPACE}" \
  jitakirin/rpmbuild MYPROJ.spec

This will build RPMs and place the results back in Jenkins' workspace directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.