FROM ubuntu:focal

ENV REDIS_PASSWORD "4StrongAndRand0mPassword"

RUN apt-get update && apt-get upgrade -y && apt-get install -y "redis-tools=5:5.0.7-2" "redis-server=5:5.0.7-2"

COPY redis.conf /etc/redis/
RUN chown root:root /etc/redis/redis.conf && chmod 644 /etc/redis/redis.conf

COPY getflag /sbin/
RUN chown root:root /sbin/getflag && chmod 2755 /sbin/getflag

COPY ./flag /
RUN chmod 440 /flag && chown root:root /flag

COPY ./docker-entrypoint.sh /
RUN chmod 555 /docker-entrypoint.sh

USER redis:redis

ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 6379

