Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
roshkhatri committed Mar 29, 2024
1 parent fa48ba3 commit 80b1feb
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
file: ./dockerfiles/Dockerfile
context: .
push: true
tags: roshkhatri/valkeydemo:latest
tags: roshkhatri/valkey:unstable
84 changes: 65 additions & 19 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,68 @@
# Use a base image
FROM alpine:latest

ENV DEBIAN_FRONTEND noninteractive
ENV TZ Etc/UTC
# Install necessary dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends tzdata && \
rm -rf /var/lib/apt/lists/*

# Download, compile, and install Redis
RUN wget https://github.com/roshkhatri/valkey/archive/unstable.tar.gz && \
tar xvzf unstable.tar.gz && \
cd unstable && \
make && \
make install

# Expose Redis default port
FROM debian:bookworm-slim

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN set -eux; \
groupadd -r -g 999 valkey; \
useradd -r -g valkey -u 999 valkey

# runtime dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
tzdata \
; \
rm -rf /var/lib/apt/lists/*

ENV VALKEY_UNSTABLE_URL https://github.com/roshkhatri/valkey/archive/unstable.tar.gz

RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
wget \
\
dpkg-dev \
gcc \
libc6-dev \
libssl-dev \
make \
pkg-config\
; \
rm -rf /var/lib/apt/lists/*;

# Download, compile, and install Valkey
RUN wget "$VALKEY_UNSTABLE_URL" && \
mkdir -p /usr/src/valkey; \
tar -xzf unstable.tar.gz -C /usr/src/valkey --strip-components=1; \
rm unstable.tar.gz; \
grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' /usr/src/valkey/src/config.c; \
sed -ri 's!^( *createBoolConfig[(]"protected-mode",.*, *)1( *,.*[)],)$!\10\2!' /usr/src/valkey/src/config.c; \
grep -E '^ *createBoolConfig[(]"protected-mode",.*, *0 *,.*[)],$' /usr/src/valkey/src/config.c; \
\
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
extraJemallocConfigureFlags="--build=$gnuArch"; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; \
*) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; \
esac; \
extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; \
grep -F 'cd jemalloc && ./configure ' /usr/src/valkey/deps/Makefile; \
sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /usr/src/valkey/deps/Makefile; \
grep -F "cd jemalloc && ./configure $extraJemallocConfigureFlags " /usr/src/valkey/deps/Makefile; \
export BUILD_TLS=yes; \
make -C /usr/src/valkey -j "$(nproc)" all; \
make -C /usr/src/valkey install;

RUN mkdir /data && chown valkey:valkey /data
WORKDIR /data
VOLUME /data

# Expose Valkey default port
EXPOSE 6379

# Run Redis server by default
CMD ["./src/valkey-server"]
# Run Valkey server by default
CMD ["/usr/local/bin/valkey-server"]

0 comments on commit 80b1feb

Please sign in to comment.