Skip to content

Commit 97e61e1

Browse files
committed
fix: Docker multi-arch build using pre-built binaries
- Switch from building in Docker to using pre-built binaries from GitHub releases - Fixes cross-compilation issues for ARM64 - Much faster builds (seconds instead of minutes) - Supports linux/amd64 and linux/arm64 platforms
1 parent ceca2b6 commit 97e61e1

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

Dockerfile

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
# Redis CLI Docker Image
2-
# Multi-stage build for optimal size
2+
# Uses pre-built binaries from GitHub releases for faster multi-arch builds
33

4-
FROM rust:1.89 AS builder
5-
6-
WORKDIR /build
7-
8-
# Copy workspace files
9-
COPY Cargo.toml ./
10-
COPY crates/ ./crates/
11-
12-
# Build release binary
13-
RUN cargo build --release --bin redisctl
14-
15-
# Runtime stage - Ubuntu for newer GLIBC
164
FROM ubuntu:24.04
175

186
# Install runtime dependencies
197
RUN apt-get update && apt-get install -y \
208
ca-certificates \
219
curl \
10+
xz-utils \
2211
&& rm -rf /var/lib/apt/lists/*
2312

24-
# Copy binary from builder
25-
COPY --from=builder /build/target/release/redisctl /usr/local/bin/redisctl
13+
# Set the version to install
14+
ARG VERSION=0.2.0
15+
ARG TARGETPLATFORM
16+
17+
# Download the appropriate binary based on platform
18+
RUN case "$TARGETPLATFORM" in \
19+
"linux/amd64") \
20+
ARCH="x86_64-unknown-linux-gnu" \
21+
;; \
22+
"linux/arm64") \
23+
ARCH="aarch64-unknown-linux-gnu" \
24+
;; \
25+
*) \
26+
echo "Unsupported platform: $TARGETPLATFORM" && exit 1 \
27+
;; \
28+
esac && \
29+
curl -L "https://github.com/joshrotenberg/redisctl/releases/download/redisctl-v${VERSION}/redisctl-${ARCH}.tar.xz" | \
30+
tar -xJ --strip-components=1 -C /tmp && \
31+
mv /tmp/redisctl /usr/local/bin/redisctl && \
32+
chmod +x /usr/local/bin/redisctl && \
33+
rm -rf /tmp/*
2634

2735
# Create non-root user
2836
RUN useradd -m redis && \
@@ -37,7 +45,7 @@ ENV REDIS_ENTERPRISE_URL=""
3745
ENV REDIS_ENTERPRISE_USER=""
3846
ENV REDIS_ENTERPRISE_PASSWORD=""
3947
ENV REDIS_CLOUD_API_KEY=""
40-
ENV REDIS_CLOUD_SECRET_KEY=""
48+
ENV REDIS_CLOUD_API_SECRET=""
4149

4250
ENTRYPOINT ["redisctl"]
4351
CMD ["--help"]

0 commit comments

Comments
 (0)