Skip to content

Commit 4c9e7dd

Browse files
committed
fix: Docker workflow to wait for release completion
- Trigger Docker build on 'release published' event instead of tag push - This ensures binaries are available before Docker build starts - Use different Dockerfiles for releases (pre-built binaries) vs dev (build from source) - Only build multi-arch for releases, single arch (amd64) for dev builds
1 parent 97e61e1 commit 4c9e7dd

File tree

3 files changed

+62
-55
lines changed

3 files changed

+62
-55
lines changed

.github/workflows/docker-publish.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Docker Publish
22

33
on:
44
push:
5-
tags:
6-
- 'redisctl-v*'
75
branches:
86
- main
7+
release:
8+
types: [published]
99
workflow_dispatch:
1010

1111
env:
@@ -46,19 +46,34 @@ jobs:
4646
type=sha,prefix=sha-
4747
type=raw,value=latest,enable={{is_default_branch}}
4848
49+
- name: Set build parameters
50+
id: build-params
51+
run: |
52+
if [[ "${{ github.event_name }}" == "release" ]]; then
53+
VERSION="${{ github.event.release.tag_name }}"
54+
VERSION="${VERSION#redisctl-v}"
55+
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
56+
echo "DOCKERFILE=./Dockerfile" >> $GITHUB_OUTPUT
57+
echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
58+
else
59+
echo "VERSION=dev" >> $GITHUB_OUTPUT
60+
echo "DOCKERFILE=./Dockerfile.dev" >> $GITHUB_OUTPUT
61+
echo "PLATFORMS=linux/amd64" >> $GITHUB_OUTPUT
62+
fi
63+
4964
- name: Build and push Docker image
5065
uses: docker/build-push-action@v5
5166
with:
5267
context: .
53-
file: ./Dockerfile.publish
54-
platforms: linux/amd64,linux/arm64
68+
file: ${{ steps.build-params.outputs.DOCKERFILE }}
69+
platforms: ${{ steps.build-params.outputs.PLATFORMS }}
5570
push: true
5671
tags: ${{ steps.meta.outputs.tags }}
5772
labels: ${{ steps.meta.outputs.labels }}
5873
cache-from: type=gha
5974
cache-to: type=gha,mode=max
6075
build-args: |
61-
RUST_VERSION=1.89
76+
VERSION=${{ steps.build-params.outputs.VERSION }}
6277
6378
- name: Update Docker Hub Description
6479
uses: peter-evans/dockerhub-description@v4

Dockerfile.dev

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Development Docker Image
2+
# Builds from source for main branch pushes
3+
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
16+
FROM ubuntu:24.04
17+
18+
# Install runtime dependencies
19+
RUN apt-get update && apt-get install -y \
20+
ca-certificates \
21+
&& rm -rf /var/lib/apt/lists/*
22+
23+
# Copy binary from builder
24+
COPY --from=builder /build/target/release/redisctl /usr/local/bin/redisctl
25+
26+
# Create non-root user
27+
RUN useradd -m redis && \
28+
mkdir -p /home/redis/.config/redisctl && \
29+
chown -R redis:redis /home/redis
30+
31+
USER redis
32+
WORKDIR /home/redis
33+
34+
# Default environment variables
35+
ENV REDIS_ENTERPRISE_URL=""
36+
ENV REDIS_ENTERPRISE_USER=""
37+
ENV REDIS_ENTERPRISE_PASSWORD=""
38+
ENV REDIS_CLOUD_API_KEY=""
39+
ENV REDIS_CLOUD_API_SECRET=""
40+
41+
ENTRYPOINT ["redisctl"]
42+
CMD ["--help"]

Dockerfile.publish

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

0 commit comments

Comments
 (0)