musarehmani100 commited on
Commit
7888793
1 Parent(s): f82eeaf

Create docker-entrypoint.sh

Browse files
Files changed (1) hide show
  1. docker-entrypoint.sh +24 -0
docker-entrypoint.sh ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ # first arg is `-f` or `--some-option`
5
+ # or first arg is `something.conf`
6
+ if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
7
+ set -- redis-server "$@"
8
+ fi
9
+
10
+ # allow the container to be started with `--user`
11
+ if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
12
+ find . \! -user redis -exec chown redis '{}' +
13
+ exec gosu redis "$0" "$@"
14
+ fi
15
+
16
+ # set an appropriate umask (if one isn't set already)
17
+ # - https://github.com/docker-library/redis/issues/305
18
+ # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37
19
+ um="$(umask)"
20
+ if [ "$um" = '0022' ]; then
21
+ umask 0077
22
+ fi
23
+
24
+ exec "$@"