Enter DockerGen: a CLI for creating projects with Docker
The problem These past days I'm using Docker a lot, just to get some practice and improve my skills. It always bugged me that whenever I wanted to run an application using Docker, I would still had to install the necessary tools and dependencies to get the initial scaffolding and then dockerize the whole thing. "Enough is enough" I said one day. I had grown tired of all the unused tools, runtimes, and frameworks bloating my hard drive. Enter DockerGen I knew it was possible to generate a scaffolding for any tool that had a Docker image available on DockerHub, but what if I took things one step further? What if I had a tool that allowed me to generate not only a sample project, but also the required files to run said project using Docker? MFernandez93 / dockergen-cli CLI tool to quickly generate local development environments with Docker. Dockergen Dockergen is a CLI tool that automates the creation of development environments using Docker. It generates the necessary Dockerfiles, docker-compose.yml files, and initializes the project structure using a temporary Docker container. Features Supports multiple programming languages: Node.js (Express), Python (Flask), PHP (Symfony) Automatically generates Dockerfiles and docker-compose.yml Creates the project skeleton using a temporary Docker container Simple installation and update commands Installation To install DockerGen globally, run: curl -sSL https://raw.githubusercontent.com/MFernandez93/dockergen-cli/main/dockergen.sh -o dockergen.sh chmod +x dockergen.sh ./dockergen.sh --install Usage dockergen [PROJECT_NAME] [LANGUAGE] PROJECT_NAME: Name of the project (default: my_project) LANGUAGE: Programming language (node, python, php) Example dockergen myapp node This will: Create a folder myapp Download the corresponding Dockerfile and docker-compose.yml Use Docker to initialize the project Commands dockergen --install → Installs Dockergen globally dockergen --update → Updates Dockergen to the latest version dockergen -h → Shows the help message Requirements Docker installed… View on GitHub As stated before, DockerGen is just a really simple Bash script that leverages the local Docker installation to create a temporary container where the project is created, and then the Docker Compose and Dockerfile files are pulled from a different repository! That's kinda awesome, I didn't know Bash scripts could do that. Next steps Honestly I had so much fun building this, I'll probably extend this in the future with support for different versions of the same tools (currently NodeJS, PHP and Python are supported), or maybe make it interactive so you can choose what would you like to add to your Docker setup (a frontend app, database, cache engine, you name it). This is my first Bash script, so comments and feedback are more than welcomed!
The problem
These past days I'm using Docker a lot, just to get some practice and improve my skills. It always bugged me that whenever I wanted to run an application using Docker, I would still had to install the necessary tools and dependencies to get the initial scaffolding and then dockerize the whole thing.
"Enough is enough" I said one day. I had grown tired of all the unused tools, runtimes, and frameworks bloating my hard drive.
Enter DockerGen
I knew it was possible to generate a scaffolding for any tool that had a Docker image available on DockerHub, but what if I took things one step further? What if I had a tool that allowed me to generate not only a sample project, but also the required files to run said project using Docker?
MFernandez93
/
dockergen-cli
CLI tool to quickly generate local development environments with Docker.
Dockergen
Dockergen is a CLI tool that automates the creation of development environments using Docker. It generates the necessary Dockerfiles, docker-compose.yml
files, and initializes the project structure using a temporary Docker container.
Features
- Supports multiple programming languages: Node.js (Express), Python (Flask), PHP (Symfony)
- Automatically generates Dockerfiles and
docker-compose.yml
- Creates the project skeleton using a temporary Docker container
- Simple installation and update commands
Installation
To install DockerGen globally, run:
curl -sSL https://raw.githubusercontent.com/MFernandez93/dockergen-cli/main/dockergen.sh -o dockergen.sh
chmod +x dockergen.sh
./dockergen.sh --install
Usage
dockergen [PROJECT_NAME] [LANGUAGE]
-
PROJECT_NAME
: Name of the project (default:my_project
) -
LANGUAGE
: Programming language (node
,python
,php
)
Example
dockergen myapp node
This will:
- Create a folder
myapp
- Download the corresponding Dockerfile and
docker-compose.yml
- Use Docker to initialize the project
Commands
-
dockergen --install
→ Installs Dockergen globally -
dockergen --update
→ Updates Dockergen to the latest version -
dockergen -h
→ Shows the help message
Requirements
- Docker installed…
As stated before, DockerGen is just a really simple Bash script that leverages the local Docker installation to create a temporary container where the project is created, and then the Docker Compose and Dockerfile files are pulled from a different repository!
That's kinda awesome, I didn't know Bash scripts could do that.
Next steps
Honestly I had so much fun building this, I'll probably extend this in the future with support for different versions of the same tools (currently NodeJS, PHP and Python are supported), or maybe make it interactive so you can choose what would you like to add to your Docker setup (a frontend app, database, cache engine, you name it).
This is my first Bash script, so comments and feedback are more than welcomed!