// Module included in the following assemblies:
//
// microshift_running_applications/embedding-apps-tutorial.adoc

:_mod-docs-content-type: PROCEDURE
[id="microshift-building-apps-rpms_{context}"]
= Building the RPM package for the application manifests

[role="_abstract"]
To build your own RPMs, you must create a spec file that adds the application manifests to the RPM package. If the application RPMs and other elements needed for image building are accessible to image builder, you can use the method that you prefer.

The following is an example procedure.

.Prerequisites
* You have set up a {op-system-ostree-first} {op-system-version} build host that meets the image builder system requirements.
* You have root access to the host.
* The file tree required to build RPM packages was created.

.Procedure

. In the `~/rpmbuild/SPECS` directory, create a file such as `_<application_workload_manifests.spec>_` using the following template:
+
.Example spec file
[source,terminal,subs="+quotes"]
----
Name: _<application_workload_manifests>_
Version: 0.0.1
Release: 1%{?dist}
Summary: Adds workload manifests to microshift
BuildArch: noarch
License: GPL
Source0: %{name}-%{version}.tar.gz
#Requires: microshift
%description
Adds workload manifests to microshift
%prep
%autosetup
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_prefix}/lib/microshift/manifests
cp -pr ~/manifests $RPM_BUILD_ROOT/%{_prefix}/lib/microshift/
%clean
rm -rf $RPM_BUILD_ROOT

%files
%{_prefix}/lib/microshift/manifests/**
%changelog
* _<DDD MM DD YYYY username@domain - V major.minor.patch>_
- _<your_change_log_comment>_
----
+
The `%install` section creates the target directory inside the RPM package, `/usr/lib/microshift/manifests/`
and copies the manifests from the source home directory, `~/manifests`.
+
[IMPORTANT]
====
All of the required YAML files must be in the source home directory `~/manifests`, including a `kustomize.yaml` file if you are using kustomize.
====

. Build your RPM package in the `~/rpmbuild/RPMS` directory by running the following command:
+
[source,terminal,subs="+quotes"]
----
$ rpmbuild -bb ~/rpmbuild/SPECS/_<application_workload_manifests.spec>_
----
