This commit is contained in:
chenc 2023-11-08 14:19:14 +08:00
parent 0b5be9a97d
commit c6c12b04f1
2 changed files with 26 additions and 2 deletions

View File

@ -89,12 +89,12 @@ services:
container_name: redis
restart: always
environment:
- requirepass=${REDIS_PASSWORD:-qq1458513}
- REDIS_PASSWORD=${REDIS_PASSWORD:-qq1458513}
volumes:
- "./redis/redis.conf:/etc/redis/redis.conf"
- "./redis/data:/data/db"
- "./logs/redis:/data/logs"
command: [ "redis-server", "/etc/redis/redis.conf" ]
command: [ "redis-server", "/etc/redis/redis.conf", "--requirepass ${REDIS_PASSWORD:-qq1458513}" ]
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 1s

View File

@ -0,0 +1,24 @@
#!/bin/sh
set -e
echo $REDIS_PASSWORD
# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
set -- redis-server "$@"
fi
# allow the container to be started with `--user`
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
find . \! -user redis -exec chown redis '{}' +
exec su-exec redis "$0" "$@"
fi
# set an appropriate umask (if one isn't set already)
# - https://github.com/docker-library/redis/issues/305
# - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37
um="$(umask)"
if [ "$um" = '0022' ]; then
umask 0077
fi
exec "$@"