Build the docker image with the modstatsd

This commit is contained in:
John Sully 2022-04-01 22:23:29 +00:00 committed by John Sully
parent 3fc16f4144
commit 415269bc50
2 changed files with 21 additions and 2 deletions

View File

@ -24,8 +24,10 @@ RUN set -eux; \
gosu nobody true
# build KeyDB
ARG KEYDB_DIR
ARG MODSTATSD_DIR
ARG MAKE_JOBS=""
COPY $KEYDB_DIR /tmp/keydb-internal/
COPY $MODSTATSD_DIR /tmp/modstatsd/
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
@ -49,6 +51,10 @@ RUN set -eux; \
libsnappy-dev \
libssl-dev \
git; \
cd /tmp/modstatsd/; \
make clean; \
make; \
mv modstatsd.so /usr/local/lib/; \
cd /tmp/keydb-internal; \
# disable protected mode as it relates to docker
grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' ./src/config.cpp; \
@ -85,6 +91,7 @@ RUN \
sed -i 's/^\(logfile .*\)$/# \1/' /etc/keydb/keydb.conf; \
sed -i 's/protected-mode yes/protected-mode no/g' /etc/keydb/keydb.conf; \
sed -i 's/^\(bind .*\)$/# \1/' /etc/keydb/keydb.conf; \
echo "loadmodule /usr/local/lib/modstatsd.so" >> /etc/keydb/keydb.conf; \
ln -s keydb-cli redis-cli; \
cd /etc/keydb; \
ln -s keydb.conf redis.conf; \

View File

@ -20,7 +20,7 @@ timestamp() {
print_usage() {
echo "Usage:"
echo " ./{script} [flags]"
echo " ./{script} {modstatsd-path} [flags]"
echo ""
echo "Flags:"
echo " -p, --provider: name of the cloud provider, can be 'gcp', 'aws' or 'both' (default)"
@ -36,6 +36,15 @@ push_image () { # 1 - image, 2 - repo
echo "`timestamp` image ${IMAGE_WITH_REPO} is pushed"
}
#Process Module Path Flag
MOD_STATSD_PATH="$1"
if [[ -z ${MOD_STATSD_PATH} ]]
then
echo "Missing path to statsd module"
# exit 1
fi
shift
# Processing flags
while [ ! $# -eq 0 ]
do
@ -73,9 +82,12 @@ do
shift
done
echo "MOD_STATSD_PATH: ${MOD_STATSD_PATH}"
echo "`timestamp` building image for ${FLAGS_tag}"
export IMAGE_SUFFIX="keydb:${FLAGS_tag}"
docker build --squash --build-arg KEYDB_DIR=. --build-arg MAKE_JOBS=${FLAGS_jobs} -t keydb:latest -f ${DIR}/Dockerfile ${DIR}/..
cp -r ${MOD_STATSD_PATH} ./modstatsd
docker build --squash --build-arg MODSTATSD_DIR=docker-internal/modstatsd --build-arg KEYDB_DIR=. --build-arg MAKE_JOBS=${FLAGS_jobs} -t keydb:latest -f ${DIR}/Dockerfile ${DIR}/..
rm -rf ./modstatsd
# Build and publish
if [[ ${FLAGS_provider} == "aws" ]] || [[ ${FLAGS_provider} == "both" ]]