The Mason CLI makes getting started with Docker a breeze - it's like buildpacks for Docker.
Whether you're new to Docker or a pro, you'll love how it just works straight out of the box.
Install the Mason CLI as a global NPM package:
npm install --global codemason
laravel new pebble
mason craft laravel
That's all! You're now running your Laravel application with Docker!
You'll be able to access your application at
<docker-ip> is the boot2docker ip or localhost if you are running Docker natively.
Now you've installed Mason, you can Dockerize your applications with just one command!
$ mason craft <craft-kit>
$ mason craft laravel
The above command pulls the craft kit from codemasonhq/craft-kit-laravel and generates a
docker-compose.yml file for you based on what's defined in the craft kit. The generated files will be added to the current working directory.
Or if you want to get a little bit more specific, you can specify exactly what containers from the craft kit you want to use.
$ mason craft laravel --with="php, postgres"
Craft kits are a super flexible and portable way to define Docker environments. They are an excellent way to ease into building Docker powered apps without having to learn the ins and outs of Docker.
Official craft kits provide an opinionated starting point for Dockerizing your apps. We've carefully selected and specifically created Docker images that play together nicely so you can Dockerize your apps with a single command.
You can find all the official craft kits within the CodemasonHQ organisation with the prefix
craft-kit-. We aim to support as many popular frameworks, architectures and languages as possible.
Officially supported craft kits:
Community contributed craft kits:
While we recommend the official craft kits for simplicity and compatibility with what we have planned, custom craft kits give you an added level of flexibility. Anyone can create a craft kit and use it with:
$ mason craft username/repo
username/repo is the short hand for the repository to retrieve.
By default it will use the
master branch, but you can specify a branch or a tag like so
username/repo#branch. You may also use the
--clone flag so your SSH keys are used (allowing you to access your private repositories).
You may also use a local craft kit.
$ mason craft ~/path/to/my/craft-kit
index.js file as an entry point which exposes the craft kit to the CLI. Beyond that, you can structure it however you see fit.
A nice example is the laravel craft kit.
|name||[string] Simple name for your craft kit|
|default||[array] Default containers for craft kit to use|
|masonJson||[object] Mason JSON for available containers|
moduleexports =name: 'laravel'default: "php" "mysql"masonJson:php:mysql:
Define the available containers using Mason JSON. Mason JSON is a JSON schema that is deliberately modelled of the
docker-compose.yml file. It makes it a little bit easier to deal with all the Docker configuration options and adds a little bit of extra functionality.
moduleexports =name: 'php'image: 'codemasonhq/php'type: 'instance'volumes:'./':'/app'ports:"80:80""443:443"
moduleexports =name: 'mysql'image: 'mysql'type: 'service'volumes:'/var/lib/mysql':'/var/lib/mysql'ports: "3306:3306"environment:'MYSQL_DATABASE': 'demo''MYSQL_USER': 'demo''MYSQL_PASSWORD': 'secret''MYSQL_ROOT_PASSWORD': 'root'
In the Mason JSON for your craft kit, you may set the
instance is your main process: it runs your application (generally an
instance is a language). It is used as the base image to build
FROM in your Dockerfile. Currently the craft command only supports one
instance per kit.
service is typically something your app utilises like MySQL, Redis or Postgres etc.
Additional documentation for the Mason CLI can be found on the Codemason website.
The MIT License (MIT). Please see License File for more information.