Created a new project with dotnet new console
.
Create a container. You should only need to do this once.
The volume path has to be shared in Docker->Preferences->File Sharing.
# MacOS
docker create -v $(pwd)/redis-config:/usr/local/etc/redis --name myredis -p 6379:6379 redis redis-server /usr/local/etc/redis
# Windows
docker create -v ${pwd}/redis-config:/usr/local/etc/redis --name myredis -p 6379:6379 redis redis-server /usr/local/etc/redis
Start the container.
docker start myredis
Note: The Redis password is externalized by setting an environment variable when starting the service per the 12 Factor App.
cd DotnetRedisStarter.Tests
RedisPassword=<password that you shouldve set in redis.conf> dotnet test
Continously run the tests.
cd DotnetRedisStarter.Tests
RedisPassword=<password that you shouldve set in redis.conf> dotnet watch test
cd DotnetRedisStarter.Tests
$env:RedisPassword=<password that you shouldve set in redis.conf>
dotnet test
Set a password in redis.conf. This folder will get bind mounted to the Redis container per docker create
command above.
dotnet run --project Reporter/Reporter.csproj RedisPassword=<password that you shouldve set in redis.conf>