Skip to content

Commit 41a8fdf

Browse files
committed
fix: add Dockerfile.test for CI that builds from source
The v0.1.1 release has no binary assets, so we need to build from source for CI tests. The regular Dockerfile will still be used for production releases once binaries are available.
1 parent a664944 commit 41a8fdf

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

Dockerfile.test

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Build stage for testing - compiles from source
2+
FROM rust:1.89-bookworm AS builder
3+
4+
WORKDIR /usr/src/redisctl
5+
6+
# Copy workspace files
7+
COPY Cargo.toml Cargo.lock ./
8+
COPY crates ./crates
9+
10+
# Build the release binary
11+
RUN cargo build --release --bin redisctl
12+
13+
# Runtime stage
14+
FROM ubuntu:24.04
15+
16+
# Install runtime dependencies
17+
RUN apt-get update && apt-get install -y \
18+
ca-certificates \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
# Copy the binary from builder
22+
COPY --from=builder /usr/src/redisctl/target/release/redisctl /usr/local/bin/redisctl
23+
24+
# Create non-root user
25+
RUN useradd -m redis && \
26+
mkdir -p /home/redis/.config/redisctl && \
27+
chown -R redis:redis /home/redis
28+
29+
USER redis
30+
WORKDIR /home/redis
31+
32+
# Default environment variables
33+
ENV REDIS_ENTERPRISE_URL=""
34+
ENV REDIS_ENTERPRISE_USER=""
35+
ENV REDIS_ENTERPRISE_PASSWORD=""
36+
ENV REDIS_CLOUD_API_KEY=""
37+
ENV REDIS_CLOUD_API_SECRET=""
38+
39+
ENTRYPOINT ["redisctl"]
40+
CMD ["--help"]

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
38+
dockerfile: Dockerfile.test
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
70+
dockerfile: Dockerfile.test
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
102+
dockerfile: Dockerfile.test
103103
container_name: validate-api
104104
restart: "no"
105105
depends_on:

0 commit comments

Comments
 (0)