Skip to content

Instantly share code, notes, and snippets.

@wittawasw
Last active June 20, 2018 05:11
Show Gist options
  • Save wittawasw/d56f84249dcf8e902fd0d22e28e73726 to your computer and use it in GitHub Desktop.
Save wittawasw/d56f84249dcf8e902fd0d22e28e73726 to your computer and use it in GitHub Desktop.
Source from redis-ml and neural-redis repo.
FROM redis:latest as builder
ENV LIBDIR /var/lib/redis/modules
ENV DEPS "libatlas-base-dev python python-setuptools python-pip wget unzip build-essential git"
# Set up a build environment
RUN set -ex;\
deps="$DEPS";\
apt-get update; \
apt-get install -y --no-install-recommends $deps;\
pip install rmtest;
# Build the source
RUN git clone https://github.com/RedisLabsModules/redis-ml.git && \
mv ./redis-ml/* /
# ADD . /
WORKDIR /
RUN set -ex;\
deps="$DEPS";\
make clean; \
make all -j 4; \
make test;
# RUN curl -o /usr/local/bin/gosu -sSL "https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64" && \
# chmod +x /usr/local/bin/gosu
RUN git clone https://github.com/antirez/neural-redis.git && \
cd neural-redis && \
make generic && \
mkdir -p /var/lib/redis/modules && \
cp neuralredis.so /var/lib/redis/modules && \
chown redis:redis /var/lib/redis/modules/neuralredis.so && \
chmod +x /var/lib/redis/modules/neuralredis.so
# Package the runner
FROM redis:latest
ENV LIBDIR /var/lib/redis/modules
WORKDIR /data
RUN set -ex;\
mkdir -p "$LIBDIR";
COPY --from=builder /src/redis-ml.so "$LIBDIR"
COPY --from=builder /var/lib/redis/modules/neuralredis.so "$LIBDIR"
EXPOSE 6379
# redis-server /usr/local/etc/redis/redis.conf --loadmodule /usr/lib/neuralredis/neuralredis.so
# redis-server /usr/local/etc/redis/redis.conf --slaveof redis-master 6379 --loadmodule /var/lib/redis/modules/neuralredis.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment