Development Environment per Project

Development Environment per Project

Development environment per project

Motivation

Development environments installed in project directory

/home/$USER/test-project/.env

Example of environment file

TOP_DIR=$(dirname $(realpath $_))
. ${TOP_DIR}/venv/bin/activate
export LD_LIBRARY_PATH=${VIRTUAL_ENV}/lib
cd ${TOP_DIR}

Append alias to shell

~/.aliases

alias test-project-env=". ~/working/test-project/.env"

~/.bashrc or ~/.zshrc

. ~/.aliases

Appply alias without restart shell

source ~/.aliases

onto test-project environment

test-project-env

Using Docker

Create Docker image for development

docker build -t test-project-dev-env:latest .

Run docker image for testing

docker run --rm -it  -v $(pwd):/apps test-project-devel bash