mirror of
https://github.com/mCaptcha/cache.git
synced 2024-11-24 01:15:31 +03:00
31 lines
707 B
Docker
31 lines
707 B
Docker
ARG REDIS_VER=7.0
|
|
|
|
# stretch|bionic|buster
|
|
ARG OSNICK=bookworm
|
|
|
|
# ARCH=x64|arm64v8|arm32v7
|
|
ARG ARCH=x64
|
|
|
|
FROM rust:slim as builder
|
|
WORKDIR /src
|
|
RUN set -ex; \
|
|
apt-get update; \
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
apt-get install -y --no-install-recommends redis clang gcc
|
|
COPY Cargo.toml Cargo.lock /src/
|
|
COPY src/lib.rs /src/src/lib.rs
|
|
RUN cargo build --release || true
|
|
COPY . /src/
|
|
RUN ls /src/src
|
|
RUN cargo build --release
|
|
|
|
FROM redis:${REDIS_VER}-${OSNICK}
|
|
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"]
|