Skip to content

Commit

Permalink
add container name option
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuspoehls committed Dec 28, 2021
1 parent 648214f commit 3adf431
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ 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'
image: 'Dockerfile'
args:
- ${{ inputs.redis-version }}
- ${{ inputs.redis-port }}
- ${{ inputs.redis-container-name }}
3 changes: 2 additions & 1 deletion start-redis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

0 comments on commit 3adf431

Please sign in to comment.