Open ianmurphy1 opened 2 years ago
@gkorland
I've gotten it to build and now redis is running with the module enabled since I made this issue yesterday so you can close, for anyone else that comes across this in the future, below is how I got it building and running in an alpine based image.
Working Dockerfile for the build part in alpine:
FROM alpine:3.16 as builder
ARG REDIS_JSON_VERSION=${redis_json_version:-2.0.9}
WORKDIR "/build"
RUN apk add --no-cache \
git \
bash \
make \
musl-dev \
clang-libs \
clang-dev \
llvm \
cargo \
rust \
&& git clone --depth 1 --branch "v${REDIS_JSON_VERSION}" https://github.com/RedisJSON/RedisJSON.git \
&& cd RedisJSON \
&& cd ./deps/readies \
&& git submodule update --init
WORKDIR "/build/RedisJSON"
RUN ./deps/readies/bin/getupdates
RUN ./deps/readies/bin/getpy3
RUN ./sbin/system-setup.py
RUN make build SHOW=1
For the module to run successfully the container image running redis with the module needs clang-libs installed:
FROM redis:local
RUN apk add --no-cache \
clang-libs
COPY --from=builder /build/RedisJSON/bin/linux-x64-release/rejson.so* "/usr/lib/redis/modules/"
And the logs on running the image:
docker run --rm redis:json
1:C 13 Jul 2022 09:16:39.725 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 13 Jul 2022 09:16:39.725 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 13 Jul 2022 09:16:39.725 # Configuration loaded
1:M 13 Jul 2022 09:16:39.725 * monotonic clock: POSIX clock_gettime
1:M 13 Jul 2022 09:16:39.726 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
1:M 13 Jul 2022 09:16:39.726 * Running mode=standalone, port=6379.
1:M 13 Jul 2022 09:16:39.726 # Server initialized
1:M 13 Jul 2022 09:16:39.726 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 13 Jul 2022 09:16:39.726 * <ReJSON> version: 20009 git sha: d8d4b19 branch: HEAD
1:M 13 Jul 2022 09:16:39.726 * <ReJSON> Exported RedisJSON_V1 API
1:M 13 Jul 2022 09:16:39.726 * <ReJSON> Enabled diskless replication
1:M 13 Jul 2022 09:16:39.726 * <ReJSON> Created new data type 'ReJSON-RL'
1:M 13 Jul 2022 09:16:39.726 * Module 'ReJSON' loaded from /usr/lib/redis/modules/rejson.so
1:M 13 Jul 2022 09:16:39.726 * Ready to accept connections
Build error in alpine image
Trying to build this module in alpine by using the Dockerfile in this repo as a guide, I'm getting errors consistently when attempting to compile redis-module.
Clip from my Dockerfile:
RUST_BACKTRACE=full
error logs: