2019-12-18 09:57:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-02-12 22:26:11 +00:00
|
|
|
REDIS_IMAGE=$1
|
|
|
|
REDIS_VERSION=$2
|
|
|
|
REDIS_PORT=$3
|
2023-08-11 20:34:55 +00:00
|
|
|
REDIS_PASSWORD=$4
|
|
|
|
REDIS_CONTAINER_NAME=$5
|
|
|
|
REDIS_REMOVE_CONTAINER=$6
|
2020-04-12 04:49:08 +00:00
|
|
|
|
2021-01-08 09:56:47 +00:00
|
|
|
if [ -z "$REDIS_VERSION" ]; then
|
|
|
|
echo "Missing Redis version in the [redis-version] input. Received value: $REDIS_VERSION"
|
|
|
|
echo "Falling back to Redis version [latest]"
|
|
|
|
REDIS_VERSION='latest'
|
|
|
|
fi
|
|
|
|
|
2023-07-25 22:36:40 +00:00
|
|
|
DOCKER_RUN_ARGS="--name $REDIS_CONTAINER_NAME --publish $REDIS_PORT:6379 --detach $REDIS_IMAGE:$REDIS_VERSION"
|
|
|
|
|
2023-08-11 20:34:55 +00:00
|
|
|
if [ -n "$REDIS_PASSWORD" ] ; then
|
|
|
|
DOCKER_RUN_ARGS="$DOCKER_RUN_ARGS redis-server --requirepass $REDIS_PASSWORD"
|
|
|
|
fi
|
|
|
|
|
2023-07-25 22:36:40 +00:00
|
|
|
if [ "$REDIS_REMOVE_CONTAINER" == "true" ] ; then
|
2023-08-11 20:34:55 +00:00
|
|
|
DOCKER_RUN_ARGS="$DOCKER_RUN_ARGS --rm"
|
2023-07-25 22:36:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Starting single-node Redis instance: $DOCKER_RUN_ARGS"
|
|
|
|
docker run $DOCKER_RUN_ARGS
|