add container name option

pull/7/head
Marcus Pöhls 2021-12-28 06:55:29 +01:00
parent 648214f09d
commit 3adf431074
2 changed files with 7 additions and 1 deletions

View File

@ -14,6 +14,10 @@ inputs:
description: 'Redis port to use and expose'
required: false
default: 6379
redis-container-name:
description: "Name of the created container. Useful if you run multiple Redis containers"
required: false
default: 'redis'
runs:
using: 'docker'
@ -21,3 +25,4 @@ runs:
args:
- ${{ inputs.redis-version }}
- ${{ inputs.redis-port }}
- ${{ inputs.redis-container-name }}

View File

@ -2,6 +2,7 @@
REDIS_VERSION=$1
REDIS_PORT=$2
REDIS_CONTAINER_NAME=$3
if [ -z "$REDIS_VERSION" ]; then
echo "Missing Redis version in the [redis-version] input. Received value: $REDIS_VERSION"
@ -10,4 +11,4 @@ if [ -z "$REDIS_VERSION" ]; then
fi
echo "Starting single-node Redis instance"
docker run --name redis --publish $REDIS_PORT:6379 --detach redis:$REDIS_VERSION
docker run --name $REDIS_CONTAINER_NAME --publish $REDIS_PORT:6379 --detach redis:$REDIS_VERSION