All Projects → marmelab → Make Docker Command

marmelab / Make Docker Command

Licence: mit
Seamlessly execute commands (composer, bower, compass) in isolation using docker and make.

Projects that are alternatives of or similar to Make Docker Command

Reggae
Build system in D, Python, Ruby, Javascript or Lua
Stars: ✭ 141 (+71.95%)
Mutual labels:  makefile, make
Zeus
An Electrifying Build System
Stars: ✭ 176 (+114.63%)
Mutual labels:  makefile, make
Terraform Makefile
Helps me actually use terraform for multiple environments
Stars: ✭ 143 (+74.39%)
Mutual labels:  makefile, make
Gomk
An opinionated Makefile for Go projects.
Stars: ✭ 96 (+17.07%)
Mutual labels:  makefile, make
Checkmake
experimental linter/analyzer for Makefiles
Stars: ✭ 420 (+412.2%)
Mutual labels:  makefile, make
Mmake
Mmake is a small program which wraps make to provide additional functionality, such as user-friendly help output, remote includes, and eventually more. It otherwise acts as a pass-through to standard make.
Stars: ✭ 1,593 (+1842.68%)
Mutual labels:  makefile, make
Intellij Makefile
Makefile support for IntelliJ-based IDEs
Stars: ✭ 164 (+100%)
Mutual labels:  makefile, make
Cookiecutter Lux Python
Cookiecutter template for an idiomatic Python project driven by Makefile
Stars: ✭ 102 (+24.39%)
Mutual labels:  makefile, make
Ios Project Env Setup
Setup your iOS project environment with a Shellscript, Makefile or Rakefile
Stars: ✭ 320 (+290.24%)
Mutual labels:  makefile, make
Task
A task runner / simpler Make alternative written in Go
Stars: ✭ 4,282 (+5121.95%)
Mutual labels:  makefile, make
Make Handbook
Handbook about modern make usage
Stars: ✭ 85 (+3.66%)
Mutual labels:  makefile, make
Bake
Bake — the strangely familiar workflow utility.
Stars: ✭ 599 (+630.49%)
Mutual labels:  makefile, make
Teachingmaterial
Various teaching material
Stars: ✭ 159 (+93.9%)
Mutual labels:  makefile, make
Mach
A remake of make (in ClojureScript)
Stars: ✭ 240 (+192.68%)
Mutual labels:  makefile, make
Mask
🎭 A CLI task runner defined by a simple markdown file
Stars: ✭ 495 (+503.66%)
Mutual labels:  makefile, make
Wordpress Starter
📦 A starter template for WordPress websites
Stars: ✭ 26 (-68.29%)
Mutual labels:  makefile, make
Do more with twitter data
Tutorials for getting the most out of Twitter data.
Stars: ✭ 78 (-4.88%)
Mutual labels:  makefile
Learn machine learning
Road to Machine Learning
Stars: ✭ 81 (-1.22%)
Mutual labels:  makefile
Sake Core
Sake's core interface.
Stars: ✭ 78 (-4.88%)
Mutual labels:  make
Stm32cube Gcc
A developement environment for projects based on the STM32Cube firmware.
Stars: ✭ 78 (-4.88%)
Mutual labels:  makefile

make-docker-command

Seamlessly execute commands (composer, bower, compass) in isolation using docker and make.

# Install bower dependencies, without installing npm or bower locally
$ make bower install

# compile compass stylesheets, without installing ruby or compass locally
$ make compass build

# install composer dependencies faqster using HHVM, without installing HHVM locally
$ make composer install

make-docker-command doesn't change the syntax of your favorite commands: just prepend make, and the command runs in a docker container. It uses docker images hosted on Docker Hub, and generates files with the right user credentials.

make-docker-command currently supports the following dockerized commands:

Tip: For command invocations with an option (like --prefer-source), use make -- instead of make:

$ make -- composer install --prefer-source

make-docker-command requires Docker 1.2, and works both on Linux and OSX.

For more details about the intention and the implementation, see the make-docker-command introduction post on the marmelab blog.

Installation

Copy the content of the Makefile from this repository to the Makefile of the projects you're working on.

Sharing SSH Keys

Some commands may require SSH keys to connect to a secured repository (e.g. GitHub). make-docker-command will use the identity and hosts file declared in the DOCKER_SSH_IDENTITY and DOCKER_SSH_KNOWN_HOSTS environment variables (default to ~/.ssh/id_rsa and ~/.ssh/known_hosts).

If you don't want to enter a passphrase each time use these keys, create a new SSH key pair without passphrase and authorize it on GitHub:

$ cd ~/.ssh
$ mkdir docker_identity && cd docker_identity
$ ssh-keygen -t rsa -f id_rsa -N ''
$ ssh-keyscan -t rsa github.com > known_hosts

Then modify the environment variable to let make-docker-command use the new key:

$ export DOCKER_SSH_IDENTITY="~/.ssh/docker_identity/id_rsa"
$ export DOCKER_SSH_KNOWN_HOSTS="~/.ssh/docker_identity/known_hosts"

Performance

Commands executed in a docker container run in about the same time on Linux. On OS X, commands with lots of disk I/Os are much slower when run inside a container. This is currently addressed by the Docker core team.

Supported Commands

composer

Install composer dependencies using the marmelab/composer-hhvm docker image, running composer on HHVM (faster than PHP).

$ make composer install

The composer cache persists between runs. The vendor directory is created using the current user name and group. Private repositories are fetched using the SSH identity file.

phpunit

Run PHP unit tests using the marmelab/phpunit-hhvm docker image, running phpunit on HHVM (faster than PHP).

$ make phpunit

bower

Uses the marmelab/bower docker image, running bower on npm.

$ make bower install

The bower cache persists between runs. The bower_components directory is created using the current user name and group. Private repositories are fetched using the SSH identity file.

compass

Uses the marmelab/compass docker image, running bower on ruby.

$ make compass build

Troubleshooting

Not using sudo / root

The user executing make command must be a member of the docker group to avoid using sudo:

$ sudo groupadd docker
$ sudo gpasswd -a my_user docker
$ sudo service docker restart

WARNING: No swap limit support

This warning shouldn't prevent the command from running, but the message means that your system needs an additional LXC configuration. See the official Docker documentation for the solution.

Permission Problem For Executing HHVM

On hosts using AppArmor, docker containers can't execute commands as non-root, even if the executable bit is set for all. Try the following commands on the host:

$ apt-get install apparmor-utils
$ aa-complain /usr/bin/lxc-start
$ aa-complain /usr/bin/docker

OS X

Docker on OS X is still rough in the edges, and you'll need a custom version of boot2docker, allowing volume mounting, to get this working.

make-docker-command will only work when called from under the /Users/ directory (because that's the only directory shered between the host and the VM).

License

make-docker-command is available under the MIT license, courtesy of marmelab.

Comments and pull requests are welcome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].