I'd like to package a Python virtualenv with fpm, so that I can deploy it to my servers. I want to setup the virtualenv somewhere in my home directory without having to use root permissions, but deploy to e.g. /opt. virtualenv itself seems to have no destdir option. I know that there is a relocatable option, but it failed for some packages in the past and I don't trust it to work in all cases. Are there any other options, besides setting up a chroot for packaging or actually setting up the virtualenv in my local /opt directory?
Inspired by this build script I've been testing and using virtualenv-tools for serveral month now to relocate virtual environments and never had any problems. It is easily possible to relocate a virtualenv with e.g.
virtualenv-tools --update-path /opt/my_project/virtualenv and package it with fpm afterwards.
That is exactly what docker does.
fpm is good enough for packing the python instance and its third-party libraries. But if you want more customization like environment variables, it can't suit everything.