2023-10-16 20:39:08 +03:00
|
|
|
ARG REDIS_VER=7.0
|
2021-06-02 16:17:11 +03:00
|
|
|
|
|
|
|
# stretch|bionic|buster
|
2023-10-16 20:39:08 +03:00
|
|
|
ARG OSNICK=bookworm
|
2021-06-02 16:17:11 +03:00
|
|
|
|
|
|
|
# ARCH=x64|arm64v8|arm32v7
|
|
|
|
ARG ARCH=x64
|
|
|
|
|
2022-02-04 14:10:36 +03:00
|
|
|
FROM rust:slim as builder
|
2021-06-02 16:17:11 +03:00
|
|
|
WORKDIR /src
|
|
|
|
RUN set -ex; \
|
|
|
|
apt-get update; \
|
|
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
|
|
apt-get install -y --no-install-recommends redis clang gcc
|
2021-12-06 10:46:03 +03:00
|
|
|
COPY Cargo.toml Cargo.lock /src/
|
2021-12-16 12:21:51 +03:00
|
|
|
COPY src/lib.rs /src/src/lib.rs
|
|
|
|
RUN cargo build --release || true
|
|
|
|
COPY . /src/
|
|
|
|
RUN ls /src/src
|
2021-06-02 16:17:11 +03:00
|
|
|
RUN cargo build --release
|
|
|
|
|
2021-12-06 10:46:03 +03:00
|
|
|
FROM redis:${REDIS_VER}-${OSNICK}
|
2021-06-02 16:17:11 +03:00
|
|
|
ARG REDIS_VER
|
|
|
|
|
|
|
|
ENV LIBDIR /usr/lib/redis/modules
|
|
|
|
WORKDIR /data
|
|
|
|
RUN mkdir -p "$LIBDIR"
|
|
|
|
|
|
|
|
COPY --from=builder /src/target/release/libcache.so "$LIBDIR"
|
|
|
|
EXPOSE 6379
|
|
|
|
CMD ["redis-server", "--loadmodule", "/usr/lib/redis/modules/libcache.so"]
|