-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtester.Dockerfile
30 lines (21 loc) · 1.2 KB
/
tester.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM ohbonsai/retree:latest as tmp
FROM python:3.6-slim-buster
COPY --from=tmp /usr/local/bin/redis-server /usr/local/bin/redis-server
COPY --from=tmp /usr/local/bin/redis-cli /usr/local/bin/redis-cli
COPY --from=tmp /usr/lib/redis/modules/retree.so /usr/lib/redis/modules/retree.so
COPY --from=tmp /data/redis.conf /etc/redis/redis.conf
# add python requirements
ADD ./tests/requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple
# set some default setting when testing
RUN mkdir -p /etc/redis \
&& sed -i 's/^\(daemonize .*\)$/# \1/' /etc/redis/redis.conf \
&& echo "\ndaemonize yes" >> /etc/redis/redis.conf \
&& sed -i 's/^\(logfile .*\)$/# \1/' /etc/redis/redis.conf \
&& sed -i 's/^\(Dir .*\)$/# \1/' /etc/redis/redis.conf \
&& echo "\nlogfile /tmp/redis-server.log" >> /etc/redis/redis.conf \
&& sed -i 's/^\(loglevel .*\)$/# \1/' /etc/redis/redis.conf \
&& echo "\nloglevel notice" >> /etc/redis/redis.conf
RUN echo "#!/bin/bash\n/usr/local/bin/redis-server /etc/redis/redis.conf --loadmodule /usr/lib/redis/modules/retree.so\npytest -s -v tests" > /run.sh
RUN chmod +x /run.sh
ENTRYPOINT ["/run.sh"]