Skip to content

Commit

Permalink
feat : redis acl 생성 방식 변경
Browse files Browse the repository at this point in the history
DESC
----
- redis acl을 별개 shell이 아닌 Dockerfile에서 생성
  • Loading branch information
Themion committed Sep 17, 2023
1 parent ac397fb commit 817c7b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
13 changes: 13 additions & 0 deletions packages/cache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,17 @@ WORKDIR /etc/redis

COPY . .

ARG REDIS_USER
ARG REDIS_PASS
ARG REDIS_PORT

RUN touch users.acl
RUN echo "user $REDIS_USER on >$REDIS_PASS allkeys allcommands" >> users.acl

RUN touch redis.conf
RUN echo "bind 0.0.0.0" >> redis.conf
RUN echo "port $REDIS_PORT" >> redis.conf
RUN echo "maxmemory 1gb" >> redis.conf
RUN echo "aclfile /etc/redis/users.acl" >> redis.conf

CMD [ "redis-server", "/etc/redis/redis.conf" ]
17 changes: 5 additions & 12 deletions packages/cache/build.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#!/bin/bash
source "../../.env"

touch users.acl
echo "user $REDIS_USER on >$REDIS_PASS allkeys allcommands" >> users.acl
docker build . \
--build-arg REDIS_USER=$REDIS_USER \
--build-arg REDIS_PASS=$REDIS_PASS \
--build-arg REDIS_PORT=$REDIS_PORT \
-t cache

touch redis.conf
echo "bind 0.0.0.0" >> redis.conf
echo "port $REDIS_PORT" >> redis.conf
echo "maxmemory 1gb" >> redis.conf
echo "aclfile /etc/redis/users.acl" >> redis.conf

docker build . -t cache

rm users.acl
rm redis.conf

0 comments on commit 817c7b0

Please sign in to comment.