Whales helps you dockerize your applications by outputting the necessary files to run your application with Docker. Check it out:
Whales is distributed and run as a Docker image, so the only thing you need is to have Docker installed and running on your machine. After that just fire up your terminal and run:
docker pull gueils/whales:latest
And that's it! You're ready to use Whales!
Here's where the magic begins, first of all in your terminal go to the project directory you want to dockerize:
cd code/path_to_project/
And then just execute the following command:
docker run \
--interactive --tty --rm \
--env API_BASE_URI=whales.herokuapp.com \
--env BELUGAS_CODE="${PWD}" \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume $(pwd):/code gueils/whales:latest
By default this command will return dev.Dockerfile
& docker-compose.yml
files, these are the files you need to run your application in a dev environment with Docker. These files are not perfect, but we're hoping them to be a great starting point for you.
If you need the files for a production environment, run the following command:
docker run \
--interactive --tty --rm \
--env API_BASE_URI=whales.herokuapp.com \
--env BELUGAS_CODE="${PWD}" \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume $(pwd):/code gueils/whales:latest whales tame -e="production"
Until now, this command only returns the Dockerfile
for production.
Whales works as a command line interface based on features analyzers, these analyzers can detect multiple features on your project through a code static analysis, in other words, thanks to these analyzers we can detect what language, framework, database and other dependencies your project uses.
Currently, we have four feature analyzers:
The above implies we only support 4 languages: Ruby, PHP, Node(JS) & Python
The architecture is simple, it is composed of a flow chain of micro-apps that work together to dockerize your project, we call these "Whales and Belugas Team", this is the outline they follow:
- The command you send on the terminal conveys a signal to Whales, so he can start the process of dockerizing your application.
- Whales ask his bud Belugas the features of your project. Belugas is the head member of the Belugas Team: The Feature Detector Team 🐳
- Belugas starts by calling his smarty-pants bud, linguistic to find out the primary language your project is using.
- Depending on this language, liguistic will ask one of his other buddies: belugas-ruby, belugas-php or belugas-python to search specific information in your repo.
- When they're done, these fellows will send back the information founded (features) to the main Belugas.
- Belugas will send the features to Whales.
- Whales will receive the features and used them along with his intelligence to build the need it Docker files
- Finally, Whales will display the files on the terminal.
Above command is a bit hard to digest at first glance, so here's a breakdown of what the options of the command are meant for:
--interactive --tty --rm
: This tells Docker to run in an interactive mode and to clean up the container when it exits.--env API_BASE_URI=whales.herokuapp.com
&env BELUGAS_CODE="${PWD}"
: This sets two environment variables, the first one tell Whales where to find our secret sauce, and the other one points out the code to analyze.volume /var/run/docker.sock:/var/run/docker.sock
: This allows us to run Docker commands inside of a container (since all Belugas are also docker images).volume $(pwd):/code gueils/whales
: This finally mounts a volume with the code of your application.
Well, they're really cool animals! 🐳 🐋 🐬
Everyone is freely to collaborate, just make sure you follow our code of conduct. Thank you contributors!
Find a bug and don't know how to fix it? Have trouble following the documentation or have a question about the project? Then. by all means please create an issue.
Just please make sure you check existing issues to see if what you're running into has been addressed already.
That's great! Just follow this steps:
- Create a separate branch for your edits
- Make sure your changes don't break the project by running your changes against current specs. We love tests! so it'll be even better if you create new ones when needed
- Open your pull request against
master
Once you've created a pull request, maintainers will chime in to review your proposed changes and to merged it if everything is right 🎉
That's great also! We already have some open issues for you to dive in.
See LICENSE
Whales is maintained with love by Icalia Labs