Skip to content

Commit 5ec260b

Browse files
committed
fix: make Dockerfile always build from source
As you pointed out, having Docker depend on release binaries creates a circular dependency issue. The Dockerfile now always builds from source, which is more reliable and supports multi-arch builds properly.
1 parent 41a8fdf commit 5ec260b

File tree

3 files changed

+19
-67
lines changed

3 files changed

+19
-67
lines changed

Dockerfile

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

4+
# Build stage
5+
FROM rust:1.89-bookworm AS builder
6+
7+
WORKDIR /usr/src/redisctl
8+
9+
# Copy workspace files
10+
COPY Cargo.toml Cargo.lock ./
11+
COPY crates ./crates
12+
13+
# Build the release binary
14+
RUN cargo build --release --bin redisctl
15+
16+
# Runtime stage
417
FROM ubuntu:24.04
518

619
# Install runtime dependencies
720
RUN apt-get update && apt-get install -y \
821
ca-certificates \
9-
curl \
10-
xz-utils \
1122
&& rm -rf /var/lib/apt/lists/*
1223

13-
# Set the version to install
14-
ARG VERSION=0.1.1
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/*
24+
# Copy the binary from builder
25+
COPY --from=builder /usr/src/redisctl/target/release/redisctl /usr/local/bin/redisctl
3426

3527
# Create non-root user
3628
RUN useradd -m redis && \

Dockerfile.test

Lines changed: 0 additions & 40 deletions
This file was deleted.

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ services:
3535
init-cluster:
3636
build:
3737
context: .
38-
dockerfile: Dockerfile.test
38+
dockerfile: Dockerfile
3939
container_name: init-cluster
4040
restart: "no"
4141
depends_on:
@@ -67,7 +67,7 @@ services:
6767
create-db:
6868
build:
6969
context: .
70-
dockerfile: Dockerfile.test
70+
dockerfile: Dockerfile
7171
container_name: create-db
7272
restart: "no"
7373
depends_on:
@@ -99,7 +99,7 @@ services:
9999
validate-api:
100100
build:
101101
context: .
102-
dockerfile: Dockerfile.test
102+
dockerfile: Dockerfile
103103
container_name: validate-api
104104
restart: "no"
105105
depends_on:

0 commit comments

Comments
 (0)