Skip to content

Commit 00cc700

Browse files
authored
Merge pull request #194 from ngaro/dockerscript
Facilitate running in docker
2 parents 8e83127 + 83cf6c4 commit 00cc700

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docker/matrix-commander

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
DATA_DIR="$HOME/.cache/matrix-commander" # Directory on the host to store credentials and other data
3+
IMAGE="matrixcommander/matrix-commander" # Docker image to use
4+
INTERACTIVE="false" # Default setting when --interactive or --pipes is not specified
5+
6+
if [ ! -d "$DATA_DIR" ]; then
7+
echo "Creating data directory at $DATA_DIR"
8+
mkdir -p "$DATA_DIR"
9+
fi
10+
echo "Matrix is running in a container. Data is stored in $DATA_DIR"
11+
12+
if [ "$1" = "--interactive" ]; then #With this setting keyboard input and screen output will be fine but piping to/from the container will not work.
13+
INTERACTIVE="true"
14+
shift
15+
elif [ "$1" = "--pipes" ]; then #With this setting keyboard input and screen output will not work but piping to/from the container will.
16+
INTERACTIVE="false"
17+
shift
18+
fi
19+
20+
docker run -i --tty=${INTERACTIVE} --rm -v "$DATA_DIR":/data:z ${IMAGE} "$@"

0 commit comments

Comments
 (0)