Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

standardize workdirs #2

Open
glvnst opened this issue Mar 17, 2020 · 0 comments
Open

standardize workdirs #2

glvnst opened this issue Mar 17, 2020 · 0 comments

Comments

@glvnst
Copy link
Contributor

glvnst commented Mar 17, 2020

It would be good to standardize workdir paths across images so that these images can be used more automatically.

Consider that...

audiosprite() {
  docker run \
    --rm \
    --interactive \
    --tty \
    --volume "$(pwd):/data" \
    "galvanist/conex:audiosprite" \
    "$@"
}

is basically the same as:

checkmake() {
  docker run \
    --rm \
    --interactive \
    --tty \
    --volume "$(pwd):/work" \
    "galvanist/conex:checkmake" \
    "$@"
}

So if we standardized on /work (when possible) then made a ~/bin/conex script like this:

#!/bin/sh

ctr="$(basename "$0")"

# this script should be called with the name of the image to run.
# accomplish that by symlinking to this script and calling the symlinks
# e.g.:
#  ln -s ~/bin/conex ~/bin/checkmake
# then run:
#  checkmake
# ... and repeat the symlink for the other containers that support it

if [ -z "$ctr" ] || [ "$ctr" = "conex" ]; then
  echo "invalid name ${ctr}. you should symlink to this script instead of using it directly"
  exit 1
fi


exec  docker run \
    --rm \
    --interactive \
    --tty \
    --volume "$(pwd):/work" \
    "galvanist/conex:${ctr}" \
    "$@"

...it would simplify things a lot (and being a command instead of shell function lets other tools like Make call these containers).

Another thing to consider is embedding labels in the conex images that tell the conex script how to run the images. One big difference with these containers is the position of the "$@" in the shell functions, it varies because with things like vueenv I want to be able to call it like this vueenv -p 8080:8080 to expose different ports.

glvnst added a commit that referenced this issue Apr 13, 2020
actualben added a commit that referenced this issue Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant