Available versions can be located by visiting Quay Container Repository.
BUILDER_VERSION=centos-7
docker pull quay.io/abn/rpmbuilder:${BUILDER_VERSION}
In this example SOURCE_DIR
contains spec file and sources for the the RPM we are building.
# set env variables for conviniece
SOURCE_DIR=$(pwd)/sources
OUTPUT_DIR=$(pwd)/output
# create a output directory
mkdir -p ${OUTPUT_DIR}
# build rpm
docker run --rm -it \
-v ${SOURCE_DIR}:/sources:z \
-v ${OUTPUT_DIR}:/output:z \
-e OUTPUT_USER=$UID \
quay.io/abn/rpmbuilder:${BUILDER_VERSION}
The output files will be available in OUTPUT_DIR
.
If you are creating a spec file, it is often useful to have a clean room debugging environment. You can achieve this by using the following command.
docker run --rm -it --entrypoint bash \
-v ${SOURCE_DIR}:/sources:z \
-v ${OUTPUT_DIR}:/output:z \
quay.io/abn/rpmbuilder:${BUILDER_VERSION}
This command will drop you into a bash shell within the container. From here, you can execute build
to build the spec file. You can also iteratively modify the specfile and re-run build
.
The following configurations are available via environment variables
Variable | Description |
---|---|
SOURCES | Configure source directory on the container file system |
OUTPUT | Configure output directory on the container file system |
RPM_LINT | If set, enables rpm linting once rpms are built |
ARCH | Target architecture to build the rpm for, defaults to x86_64 |
The following volumes can be mounted from the host.
Volume | Description |
---|---|
/sources | Source to build RPM from |
/output | Output directory where all built RPMs and SRPMs are extracted to |