savoirfairelinux / cqfd

cqfd helps running commands inside the Docker container configured for your project, keeping the user and working directory the same inside the container
GNU General Public License v3.0
65 stars 31 forks source link

add 'docker run' pre command #82

Closed gdoffe closed 1 year ago

gdoffe commented 4 years ago

It could be useful to launch some custom commands just before the 'docker run' one to prepare a specific environment. An example is to create a pool of cqfd running instances using 'sem' command with: 'export CQFD_DOCKER_PRE_RUN="sem -j2 --fg --tty --id cqfd.sem"' This will create a pool of 2 (-j2) running cqfd instances and will make the 3rd instance waiting a previous one to end. This kind of setup is often useful on build servers to allocate build tokens. If CQFD_DOCKER_PRE_RUN is not set, 'docker run' will be launched normally by setting CQFD_DOCKER_PRE_RUN to your current shell interpreter '$SHELL -c'.

Signed-off-by: Gilles DOFFE gilles.doffe@savoirfairelinux.com

cperrysfl commented 2 years ago

Hello Gilles,

Would running sem -j2 --fg --tty --id cqfd.sem cqfd directly from the shell do the same thing?

I think if people want to wrap cqfd in something else, they will use the facility of the wrapping program rather than look for something inside CQFD. For example: sudo cqfd looks more intuitive than CQFD_DOCKER_PRE_RUN=sudo cqfd.