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

Facilitate running in docker #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docker/matrix-commander
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
DATA_DIR="$HOME/.cache/matrix-commander" # Directory on the host to store credentials and other data
IMAGE="matrixcommander/matrix-commander" # Docker image to use
INTERACTIVE="false" # Default setting when --interactive or --pipes is not specified

if [ ! -d "$DATA_DIR" ]; then
echo "Creating data directory at $DATA_DIR"
mkdir -p "$DATA_DIR"
fi
echo "Matrix is running in a container. Data is stored in $DATA_DIR"

if [ "$1" = "--interactive" ]; then #With this setting keyboard input and screen output will be fine but piping to/from the container will not work.
INTERACTIVE="true"
shift
elif [ "$1" = "--pipes" ]; then #With this setting keyboard input and screen output will not work but piping to/from the container will.
INTERACTIVE="false"
shift
fi

docker run -i --tty=${INTERACTIVE} --rm -v "$DATA_DIR":/data:z ${IMAGE} "$@"