This Yeoman Generator will add a Docker scaffolding to your project, including Dockerfile, docker-compose and a dev script to simplify management of Docker and app runtime.
The dev
script automates getting your application up and running, starting, stopping, and other misc. missing docker commands.
./app
)OSX
if you are totally new to nodejs, you can install via ./dev init
.
This will install nvm (node version manager via Homebrew, then install node 4.4.6
and run npm install -g yo git://github.com/atomantic/generator-dockerize.git
for you).
You can run the dev init
script from curl like so:
curl https://raw.githubusercontent.com/atomantic/generator-dockerize/master/dev | sh -s init
If you are already using node and have npm, just run this:
npm install -g yo git://github.com/atomantic/generator-dockerize.git
# cd to your project directory
yo dockerize
yo dockerize
on your project./app/exec
to have proper app execute instructionsdocker-compose.tmpl
if neededdev.init.sh
if needed to run any host setup before docker image is createddev init
The dev
script will ensure that you have all the docker software and configuration needed to run and will run your app inside a docker container.
You can run dev test
to test either the running instance or to run and test a new instance.
Before running dev test
, you should update test.sh (at the bottom) to add a test runner execution command.
yo dockerize
to have instructions for running your apprun dev help
to get a list of options on the dev
script
To get updates to the dockerized dev toolkit after you run the generator, simply run dev update
. This will fetch the latest dev toolkit from github and replace it in your project. Then you can use any new automated fixes for docker that are in the latest release.
Please contribute! We welcome all pull-requests. The current setup makes certain assumptions that we probably don't always want. TODO:
dev.init.sh
script and handle that, removing it if you don'tWe could make this whole thing work from yo instead of requiring users to manually adjust their files after scaffolding :)
VirtualBox
managementVPN
tomfooleryRSYNC
ugliness (now native)./dev insecure
-- now set insecure registries in advanced settings in native docker appVM_NAME
, VM_CREATE_TIME
, RSYNC
options from dev.configexport $DOCKER_NATIVE=true
-- this is temporary until this becomes an open standard method for running docker.brew install openconnect
then sudo openconnect --user=$VPNUSER $VPNHOST
instead of Cisco Client). If this solution is still interesting to you, see here: https://github.com/atomantic/generator-dockerize/commit/a79c26ceea4bacd0906f0f32dbb9b1751feb528edev vpn_setup
before connecting to VPN to create docker-machine VMdev vpn_env
to get the environment variables you need to access VM over VPNdev purge
is now interactive (allows you to choose which things you wish to purge/uninstall)dev shell
to work even if your instance fails to run (still does docker run -i -t $APP_NAME_LOCAL bash
instead of using exec
while assuming running instance)dev init
. Will provide diagram later :)dev.init.sh
script to customize a pre-setup script for the project. This is to address an issue we found with docker-rsync deleting our node_modules inside the VM. We needed to do npm install
on the host before building the docker image and rsyncing. The Dockerfile then does npm rebuild
to recompile packages for the Docker OSdev update
will fetch the latest dev
toolkit and replace it in your projectdev test
dev
docs and commandsdev
methodsdev vpn
to fix OSX routing table after disconnecting from Cisco AnyConnect VPN clientHey dude! Help me out for a couple of :beers:!