From cbcd743649f56c78dc2f9248550b8af40c361bdf Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sun, 1 Dec 2024 17:11:27 +0100 Subject: [PATCH] docker: add redis instance --- compose.yml | 11 +++++++++++ docker/redis/Dockerfile | 6 ++++++ docker/redis/redis.conf | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 docker/redis/Dockerfile create mode 100644 docker/redis/redis.conf diff --git a/compose.yml b/compose.yml index 6ae60976..fe967be2 100644 --- a/compose.yml +++ b/compose.yml @@ -23,6 +23,7 @@ services: volumes: - ./local-instances/${INSTANCE:-0}/www:/var/www - ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf + - redis-sock:/var/run/redis #MySQL Service db: @@ -36,3 +37,13 @@ services: MYSQL_ROOT_PASSWORD: password volumes: - ./local-instances/${INSTANCE:-0}/mysql:/var/lib/mysql + + redis: + build: + context: ./ + dockerfile: ./docker/redis/Dockerfile + volumes: + - redis-sock:/var/run/redis + +volumes: + redis-sock: diff --git a/docker/redis/Dockerfile b/docker/redis/Dockerfile new file mode 100644 index 00000000..9ab7f7fc --- /dev/null +++ b/docker/redis/Dockerfile @@ -0,0 +1,6 @@ +FROM redis:7.4-alpine + +RUN mkdir -p /var/run/redis && chmod 777 /var/run/redis +COPY ./docker/redis/redis.conf /etc/redis.conf + +ENTRYPOINT [ "docker-entrypoint.sh", "/etc/redis.conf" ] diff --git a/docker/redis/redis.conf b/docker/redis/redis.conf new file mode 100644 index 00000000..609d57ff --- /dev/null +++ b/docker/redis/redis.conf @@ -0,0 +1,16 @@ +# Accept connections on the specified port, default is 6379 (IANA #815344). +# If port 0 is specified Redis will not listen on a TCP socket. +#port 6379 +port 0 + +# Unix socket. +# +# Specify the path for the Unix socket that will be used to listen for +# incoming connections. There is no default, so Redis will not listen +# on a unix socket when not specified. +# +unixsocket /var/run/redis/redis-server.sock +# Executig a socket is a no-op, and we need to share acces to other programs. +# Shared the connection only with programs in the redis group for security. +#unixsocketperm 700 +unixsocketperm 666