X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=docker%2FDockerfile.redis;h=b3f921a21e7083845e8c7b0014e658b63c85e6f1;hb=HEAD;hp=a8b0c323989d1aae0512e3591be1d1507bf12382;hpb=87fd3ca9bf5cc0949dffc44ac68f0964964bee41;p=ric-plt%2Fdbaas.git diff --git a/docker/Dockerfile.redis b/docker/Dockerfile.redis index a8b0c32..b3f921a 100644 --- a/docker/Dockerfile.redis +++ b/docker/Dockerfile.redis @@ -1,5 +1,5 @@ # Copyright (c) 2019 AT&T Intellectual Property. -# Copyright (c) 2019 Nokia. +# Copyright (c) 2019-2022 Nokia. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,32 +13,80 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:latest +# +# This source code is part of the near-RT RIC (RAN Intelligent Controller) +# platform project (RICP). +# + +ARG SDLGO_TAG="v0.10.0" + +# Alpine-linux based containers use musl implementation of libc which causes +# valgrind to emit false positives. Therefore we run UT with valgrind in +# a separate build stage that uses ubuntu container with GNU libc installed. +# +# NOTE: The valgrind false positive problem could also potentially be solved +# with valgrind suppression files but that kind of approach may be fragile. +FROM ubuntu:18.04 as cpputest-build -# Install redis RUN apt update && \ - apt install -y redis-server && \ - apt clean - -# Install Redis modules -RUN apt install -y build-essential && \ - apt install -y automake && \ - apt install -y libtool && \ - apt clean -COPY ./redismodule ./redismodule + apt install -y \ + automake \ + autoconf \ + cmake \ + curl \ + g++ \ + gcc \ + libtool \ + make \ + pkg-config \ + valgrind \ + lcov + +# Cpputest built-in memory checks generate false positives in valgrind. +# This is solved by compiling cpputest with memory checking disabled. +WORKDIR /cpputest +RUN curl -L https://github.com/cpputest/cpputest/releases/download/v3.8/cpputest-3.8.tar.gz | \ + tar --strip-components=1 -xzf - +WORKDIR /cpputest/builddir +RUN cmake -DMEMORY_LEAK_DETECTION=OFF .. && \ + make install + +COPY ./redismodule /redismodule WORKDIR /redismodule RUN ./autogen.sh && \ ./configure && \ - make install -j + make test + +RUN ./autogen.sh && \ + ./configure --disable-unit-test-memcheck && \ + make test + +FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-go:2.0.0 as build-env +ARG SDLGO_TAG + +RUN apk add cpputest +COPY ./redismodule /redismodule +WORKDIR /redismodule +RUN ./autogen.sh && \ + ./configure --disable-unit-test-memcheck && \ + make test && \ + make install + +# Build sdlcli -tool +RUN cd /go/src && \ + git clone --depth 1 --branch ${SDLGO_TAG} "https://gerrit.o-ran-sc.org/r/ric-plt/sdlgo" && \ + cd sdlgo && \ + go build -v -o /usr/local/bin/sdlcli cmd/sdlcli/main.go -# Create suitable configuration file -RUN sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf && \ - sed -i 's/^\(daemonize .*\)$/# \1/' /etc/redis/redis.conf && \ - sed 's/^protected-mode yes/protected-mode no/' -i /etc/redis/redis.conf && \ - echo 'loadmodule /usr/local/libexec/redismodule/libredismodule.so' >> /etc/redis/redis.conf && \ - sed -i 's/^\(save .*\)$/# \1/' /etc/redis/redis.conf && \ - echo 'save ""' >> /etc/redis/redis.conf +FROM redis:6.2.14-alpine3.18 as build -EXPOSE 6379 +RUN apk --update add --upgrade --no-cache \ + apk-tools \ + openssl \ + ssl_client \ + musl-utils \ + busybox -CMD ["redis-server", "/etc/redis/redis.conf"] +COPY --from=build-env /usr/local/libexec/redismodule/libredismodule.so /usr/local/libexec/redismodule/libredismodule.so +COPY --from=build-env /usr/local/bin/sdlcli /usr/local/bin/ +WORKDIR /data