gh repo create my-new-project --template jeremy-step/docker-web-development --clone [--private]or just clone it without creating a new repository...
gh repo clone jeremy-step/docker-web-development my-new-projector
git clone https://github.com/jeremy-step/docker-web-development.git my-new-projectA simple shell script is included, located in the /bin directory (./bin/app ...), to run basic Docker CLI commands:
| Command | Description |
|---|---|
app up [<container>] [-d] [--build] |
Start / Build container(s). |
app stop [<container>] |
Stop container(s). |
app restart [<container>] |
Restart container(s). |
app down [<container>] [-v] |
Remove container(s). |
app sh [--user root] [options] <container> |
Access container shell.
|
app composer [args] |
Use composer. |
app c [args] |
Alias for: "app composer [args]" |
app pnpm [args] |
Use pnpm (if installed). |
app pm [args] |
Alias for: "app pnpm [args]" |
For example:
app up ...executesdocker compose --env-file=./.docker/.env up ...app sh <container>executesdocker exec -it <container> sh
Instead of writing bin/app ... or ../bin/app ..., you can create a global alias / function that executes the script for the current project.
For example, if we have our projects in the ~/projects directory, we can export the following function in our ~/.bashrc or ~/.bash_aliases file:
function app()
{
project=$(echo "$PWD" | grep -oP "^$HOME/projects/[^/]+/?")
if [ "$project" == "" ]; then
printf "You are not located in a project directory...\n"
return
fi
cmd="${project%/}/.docker/bin/app"
eval "$cmd ${@}"
return
}
export -f appNow, if we execute the app ... command, it will automatically find the correct ~/projects/<current-project>/.docker/bin/app shell script.
Don't forget to modify the path to your projects directory based on your structure. Of course, if the app function name is too generic, you can change it to your liking.
web-server(Apache 2 Alpine)application(PHP 8.4 FPM Alpine, Node.js Latest - Optional)mail(Mailpit Latest)database(MySQL 8.4)cache(Redis 7.4 Alpine)adminer(Adminer Latest)