Skip to content

Commit 38c0bce

Browse files
authored
Merge pull request #27 from RedisLabs/almog-support-arm64-RED-181280
RED-181280 - support multiarch ** to build it we need to run: make docker-push IMAGE_NAME=redislabs/redis-webcli TAG=<tag-number>
2 parents 281219a + 79ada70 commit 38c0bce

File tree

3 files changed

+56
-7
lines changed

3 files changed

+56
-7
lines changed

Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
FROM python:3.8
1+
FROM python:3.11-bookworm
2+
3+
# Docker automatically provides TARGETARCH (amd64, arm64, etc.) for multi-platform builds
4+
ARG TARGETARCH
5+
ARG MEMTIER_VERSION=2.1.1
26

37
ENV FLASK_APP app.py
48
ENV APP_SETTINGS settings.cfg
59
ENV NO_URL_QUOTING True
10+
11+
# Install memtier_benchmark from GitHub releases
12+
# Downloads the appropriate .deb file based on target architecture
13+
# Note: Version 2.1.1 is not available in the Redis APT repository, only on GitHub releases
14+
RUN curl -fsSL -o /tmp/memtier-benchmark.deb \
15+
"https://github.com/RedisLabs/memtier_benchmark/releases/download/${MEMTIER_VERSION}/memtier-benchmark_${MEMTIER_VERSION}.bookworm_${TARGETARCH}.deb" && \
16+
apt-get update && \
17+
apt-get install -y --no-install-recommends /tmp/memtier-benchmark.deb && \
18+
rm /tmp/memtier-benchmark.deb && \
19+
rm -rf /var/lib/apt/lists/* && \
20+
memtier_benchmark --version
21+
622
COPY . /app
723
WORKDIR /app
824

925
RUN pip install -r requirements.txt
1026

11-
RUN make memtier_benchmark
12-
1327
CMD python -m flask run -p 8080 -h 0.0.0.0

Makefile

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,42 @@
22
push: memtier_benchmark
33
cf push
44

5+
# Legacy target - no longer needed as memtier_benchmark is installed via APT in Dockerfile
56
memtier_benchmark:
6-
wget https://s3.eu-central-1.amazonaws.com/redislabs-dev-public-deps/binaries/memtier_benchmark_1.2.15_xenial
7-
mv memtier_benchmark_1.2.15_xenial memtier_benchmark
8-
chmod +x memtier_benchmark
7+
@echo "memtier_benchmark is now installed via APT package in the Docker image"
8+
@echo "This target is kept for backward compatibility only"
9+
10+
# Docker multi-platform build targets
11+
.PHONY: docker-build docker-buildx-setup docker-push
12+
13+
# Docker image configuration
14+
# Usage: make docker-push TAG=v1.2.3
15+
# To override image name: make docker-push IMAGE_NAME=myregistry/myimage TAG=v1.2.3
16+
# To override memtier version: make docker-push TAG=v1.2.3 MEMTIER_VERSION=2.1.4
17+
# WARNING: TAG is required for push commands to prevent accidental overwrites
18+
IMAGE_NAME ?= redislabs/redis-webcli
19+
TAG ?=
20+
MEMTIER_VERSION ?= 2.1.1
21+
22+
# Setup buildx for multi-platform builds (run once)
23+
docker-buildx-setup:
24+
docker buildx create --name multiarch --use || docker buildx use multiarch
25+
docker buildx inspect --bootstrap
26+
27+
# Build multi-platform image (AMD64 + ARM64)
28+
docker-build:
29+
docker buildx build --platform linux/amd64,linux/arm64 \
30+
--build-arg MEMTIER_VERSION=$(MEMTIER_VERSION) \
31+
-t $(IMAGE_NAME):$(TAG) .
32+
33+
# Build and push multi-platform image (requires TAG to be set)
34+
docker-push:
35+
@if [ -z "$(TAG)" ]; then \
36+
echo "Error: TAG is required. Usage: make docker-push TAG=v1.2.3"; \
37+
exit 1; \
38+
fi
39+
docker buildx build --platform linux/amd64,linux/arm64 \
40+
--build-arg MEMTIER_VERSION=$(MEMTIER_VERSION) \
41+
-t $(IMAGE_NAME):$(TAG) --push .
42+
43+

app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self, master_ip, master_port, redis_password=None, argument_line=""
6060
self._process = None
6161

6262
def run(self):
63-
self._process = subprocess.Popen(["./memtier_benchmark", "-s", self._master_ip, "-p", self._master_port, "-a", self._redis_password] + self._argument_list,
63+
self._process = subprocess.Popen(["memtier_benchmark", "-s", self._master_ip, "-p", self._master_port, "-a", self._redis_password] + self._argument_list,
6464
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, shell=False)
6565
while True:
6666
curr_output = self._process.stdout.readline().decode("utf-8")

0 commit comments

Comments
 (0)