Modern applications require a set of steps to take place prior to preparing the application for deployment, these steps might include:
- Installing dependencies eg. Composer
- Building the theme eg. Gulp
Once these steps have been executed the application then needs to be stored in an artefact which can be managed by the platform.
This process is known as packaging.
Complex pipelines and tooling need to be implemented to facilitate the packaging process.
Skpr has streamlined this process into a simple command.
$ skpr package --help usage: skpr package [<flags>] <version> Package application Flags: --help Show context-sensitive help (also try --help-long and --help-man). --region="ap-southeast-2" Region which the AWS ECR registry resides. --context="." Path which to use as a context for building images. --no-push Don't push images to the registry after being built. Used for local debugging. --dockerfile-compile=".skpr/package/compile.dockerfile" Dockerfile to use for compiling the application --dockerfile-cli=".skpr/package/cli.dockerfile" Dockerfile to use for compiling the application --dockerfile-fpm=".skpr/package/fpm.dockerfile" Dockerfile for building the PHP FPM image --dockerfile-nginx=".skpr/package/nginx.dockerfile" Dockerfile for building the Nginx image Args: <version> Version to package. Generally corresponds to git tag.
As a developer you may have a step failing while packaging and need to debug.
By running the following command the built artefact will stay on the host machine and won't be pushed to the platform.
skpr package <VERSION> --no-push
The Build Process
The build process is split up into 3 stages and managed by multiple Dockerfiles.
The application is built and stored in the
This results in a temporary image where the application was only built once.
The application is then packaged into 3 images:
- CLI - Used for commandline access and cron tasks.
- FPM - Executes PHP.
- Nginx - Serves static assets and routes to the PHP component.
Each of these images add the compiled application from the previous "compile" image.
Developers are then able to modify each layer suite their needs eg. custom Nginx configuration.
Once the application is packaged, it's time to push to the platform so it can be deployed.
skpr package command handles authentication to the AWS ECR and pushes to the designed Docker registry.