Skip to content

standardize workdirs #2

Open
Open
@glvnst

Description

@glvnst

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions