SPOC building and packaging ============================= .. image:: attachments/schema-spoc-builder.png :alt: Deliverable lifecycle - Building and packaging schema :align: center Usage ----- ``spoc-image build`` creates an LXC image based on a file with a sequence of build directives (also known as build recipe) given via command line parameter. The directory in which the file resides is taken as build context, i.e. all relative paths in the recipe are resolved from it. .. code-block:: text usage: spoc-image build [-f] [-p] filename positional arguments: filename Path to the file with build recipe optional arguments: -f, --force Force rebuild already existing image -p, --publish Publish the image after successful build ``spoc-image publish`` creates a `.tar.xz` archive of the built image and publishes it to the publish repository along with its metadata. .. code-block:: text usage: spoc-image publish [-f] image positional arguments: image Name of the image to publish optional arguments: -f, --force Force republish already published image To remove published image from publish repo, ``spoc-image unpublish`` command should be used. .. code-block:: text usage: spoc-image unpublish image positional arguments: image Name of the image to unpublish Conversely, ``spoc-app publish`` creates a `.tar.xz` archive of the application setup scripts (``install.sh``, ``update.sh``, ``uninstall.sh`` and associated directories) and publishes it to the publish repository along with its metadata. .. code-block:: text usage: spoc-app publish [-f] filename positional arguments: filename Path to metadata file of the application to publish optional arguments: -f, --force Force republish already published application And to remove the published application, ``spoc-app unpublish`` should be used. .. code-block:: text usage: spoc-app unpublish [-h] app positional arguments: app Name of the application to unpublish Build directives ---------------- The syntax is designed to resemble *Dockerfile* syntax in order to ease the potential transition. Since LXC operates on much lower level of abstraction than Docker, some principles are applied more explicitly and verbosely. Major difference between Docker and SPOC is that every directive in *Dockerfile* creates a new filesystem layer whereas layers in SPOC are managed manually and there's usually only a single layer produced from the build recipe. IMAGE ^^^^^ - **Usage:** ``IMAGE `` - **Description:** Sets image/layer name. Every image/layer needs to have one. Any subsequent directives requiring to be handled in containers namespace will use this name also to create a temporary LXC container. - **Docker equivalent:** ``-t`` in ``docker build`` command line parameters FROM ^^^^^ - **Usage:** ``FROM `` - **Description:** Designates an OverlayFS layer on which the layer will be based. Unlike *Dockerfile*'s `FROM`, is SPOC this directive is optional, so if no ``FROM`` directive is given, it translates to Docker's ``FROM scratch``. - **Docker equivalent:** ``FROM`` RUN ^^^ - **Usage:** .. code-block:: docker RUN