Skip to content

Instantly share code, notes, and snippets.

@matthewstokeley
Created February 29, 2020 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewstokeley/b598d68dcf3b20918e008e3debda0395 to your computer and use it in GitHub Desktop.
Save matthewstokeley/b598d68dcf3b20918e008e3debda0395 to your computer and use it in GitHub Desktop.
#! /usr/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Containerized Node Development Environment
#
# @version 0.0.2
CONFIG=secret.env
COMPOSE=docker-compose.yml
## Docker-Compose Aliases
if [ .aliases -e ]
then
touch .aliases
fi
echo "alias dcc='docker-compose'" >> .aliases
source .aliases
## Fetch generic docker composition file
if [ docker-compose.yml -e ]
then
touch docker-compose.yml
fi
curl https://gist.githubusercontent.com/matthewstokeley/e14ac60807bd196690b7e1c24a6444e5/raw/47e2077f6e181c82dd9d64dcb0c37c61ffe95aac/docker-compose.yml > docker-compose.yml
touch .gitignore && echo $CONFIG >> .gitignore
## Version the composition file
git init && git checkout -b "feature/docker-configuration" && git add -A && git commit -m "add the docker configuration file"
## Create or use an environment variable configuration file
if [ $CONFIG -e ]
then
touch $CONFIG
echo "MYSQL_ROOT_PASSWORD: ******" >> $CONFIG
echo "MYSQL_DATABASE: ******" >> $CONFIG
echo "MYSQL_USER: ******" >> $CONFIG
echo "MYSQL_PASSWORD: ******" >> $CONFIG
echo "LOCAL_THEME_PATH: ./" >> $CONFIG
fi
# Populate the docker config file
# @todo
sed /awk '{print $1}' $CONFIG/awk '{print $2}' $CONFIG/ $COMPOSE
# move the bootloading script into the shared valume and install dependencies
npm init -y && npm install
## Boot Services
dcc up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment