Skip to content

Commit 13c53c3

Browse files
committed
feat: add ARM64 multi-platform Docker image support
- Add linux-arm64 binary download from radar repo - Create Dockerfile.multiplatform for Debian-based multi-arch images - Create Dockerfile.alpine.multiplatform for Alpine-based multi-arch images - Use TARGETARCH to select correct binary (amd64 vs arm64) - Build and push images for both linux/amd64 and linux/arm64 - Update release notes to document ARM64 support - Tag latest/debian-latest images as multi-platform - Enables native Docker support on Apple Silicon and ARM64 servers
1 parent d7200f6 commit 13c53c3

File tree

3 files changed

+149
-18
lines changed

3 files changed

+149
-18
lines changed

.github/workflows/release.yml

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
# Copy all binaries to root for consistent access
3434
cp ./binaries/radar-agent-linux/radar-agent-linux ./radar-agent-linux
3535
cp ./binaries/radar-agent-linux-musl/radar-agent-linux-musl ./radar-agent-linux-musl
36+
cp ./binaries/radar-agent-linux-arm64/radar-agent-linux-arm64 ./radar-agent-linux-arm64
3637
cp ./binaries/radar-agent-darwin/radar-agent-darwin ./radar-agent-darwin
3738
3839
# Make binaries executable
@@ -51,6 +52,7 @@ jobs:
5152
path: |
5253
radar-agent-linux
5354
radar-agent-linux-musl
55+
radar-agent-linux-arm64
5456
radar-agent-darwin
5557
retention-days: 1
5658

@@ -68,6 +70,9 @@ jobs:
6870
name: agent-binaries
6971
path: ./
7072

73+
- name: Set up QEMU
74+
uses: docker/setup-qemu-action@v3
75+
7176
- name: Set up Docker Buildx
7277
uses: docker/setup-buildx-action@v3
7378

@@ -98,33 +103,31 @@ jobs:
98103
run: |
99104
echo "tag_name=${{ github.event.client_payload.ref }}" >> $GITHUB_OUTPUT
100105
101-
- name: Build and push Debian image
106+
- name: Build and push multi-platform Debian image
102107
uses: docker/build-push-action@v5
103108
with:
104109
context: .
105-
file: ./docker/Dockerfile
106-
build-args: |
107-
BINARY=radar-agent-linux
110+
file: ./docker/Dockerfile.multiplatform
108111
push: true
109112
tags: |
113+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag_name }}
114+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
110115
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:debian-${{ steps.tag.outputs.tag_name }}
111116
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:debian-latest
112117
labels: ${{ steps.meta.outputs.labels }}
113-
platforms: linux/amd64
118+
platforms: linux/amd64,linux/arm64
114119

115-
- name: Build and push Alpine image
120+
- name: Build and push multi-platform Alpine image
116121
uses: docker/build-push-action@v5
117122
with:
118123
context: .
119-
file: ./docker/Dockerfile.alpine
120-
build-args: |
121-
BINARY=radar-agent-linux-musl
124+
file: ./docker/Dockerfile.alpine.multiplatform
122125
push: true
123126
tags: |
124127
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${{ steps.tag.outputs.tag_name }}
125128
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-latest
126129
labels: ${{ steps.meta.outputs.labels }}
127-
platforms: linux/amd64
130+
platforms: linux/amd64,linux/arm64
128131

129132
release:
130133
name: Create Release
@@ -156,7 +159,7 @@ jobs:
156159
run: |
157160
# Create and explicitly sign the tag with -s flag
158161
git tag -s ${{ steps.tag.outputs.tag_name }} -m "Release ${{ steps.tag.outputs.tag_name }}" --force
159-
162+
160163
# Push the signed tag to the repository
161164
git push origin ${{ steps.tag.outputs.tag_name }} --force
162165
@@ -168,24 +171,30 @@ jobs:
168171
files: |
169172
radar-agent-linux
170173
radar-agent-linux-musl
174+
radar-agent-linux-arm64
171175
radar-agent-darwin
172176
make_latest: true
173177
body: |
174178
## Radar Agent Release ${{ steps.tag.outputs.tag_name }}
175179
176180
### Quick Install
177181
178-
**Linux (glibc):**
182+
**Linux AMD64 (glibc):**
179183
```bash
180184
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux" -o radar-agent
181185
```
182186
183-
**Linux (musl):**
187+
**Linux AMD64 (musl):**
184188
```bash
185189
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-musl" -o radar-agent
186190
```
187191
188-
**macOS:**
192+
**Linux ARM64:**
193+
```bash
194+
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-arm64" -o radar-agent
195+
```
196+
197+
**macOS (Apple Silicon):**
189198
```bash
190199
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-darwin" -o radar-agent
191200
```
@@ -196,13 +205,25 @@ jobs:
196205
sudo cp radar-agent /usr/local/bin/radar-agent
197206
```
198207
199-
**Docker:**
208+
**Docker (Multi-Platform - AMD64 & ARM64):**
200209
```bash
201-
# Alpine (recommended)
202-
docker pull ghcr.io/redis-field-engineering/radar-agent:alpine-${{ steps.tag.outputs.tag_name }}
210+
# Latest (Debian-based, works on both AMD64 and ARM64)
211+
docker pull ghcr.io/redis-field-engineering/radar-agent:latest
212+
213+
# Specific version
214+
docker pull ghcr.io/redis-field-engineering/radar-agent:${{ steps.tag.outputs.tag_name }}
203215
216+
# Alpine (recommended for minimal size)
217+
docker pull ghcr.io/redis-field-engineering/radar-agent:alpine-latest
218+
204219
# Debian
205-
docker pull ghcr.io/redis-field-engineering/radar-agent:debian-${{ steps.tag.outputs.tag_name }}
220+
docker pull ghcr.io/redis-field-engineering/radar-agent:debian-latest
206221
```
222+
223+
### Platform Support
224+
225+
- **AMD64 (x86_64)**: All binaries and Docker images
226+
- **ARM64 (aarch64)**: Native binary + multi-platform Docker images
227+
- **Apple Silicon (M1/M2/M3)**: Native macOS binary + ARM64 Docker images
207228
env:
208229
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM alpine:3.18
2+
3+
# TARGETARCH is automatically set by Docker buildx (amd64, arm64, etc.)
4+
ARG TARGETARCH
5+
6+
LABEL org.opencontainers.image.source="https://github.com/redis-field-engineering/radar-agent" \
7+
org.opencontainers.image.licenses="Redis, Inc." \
8+
org.opencontainers.image.authors="Radar Team"
9+
10+
# Install required packages and create user
11+
RUN apk add --no-cache \
12+
ca-certificates \
13+
curl \
14+
libgcc && \
15+
adduser -D -g "" appuser
16+
17+
# Create necessary directories
18+
RUN mkdir -p /certs /etc/agent /home/appuser/bin && \
19+
chown -R appuser:appuser /certs /etc/agent /home/appuser
20+
21+
# Copy default config (customers may override via volume)
22+
COPY --chown=appuser:appuser radar-agent-config-sample.yml /etc/agent/config.yaml
23+
24+
# Copy the correct binary based on architecture
25+
# For Alpine, we use musl binaries
26+
# Note: Currently we only have musl for amd64, so arm64 will use glibc binary
27+
COPY radar-agent-linux* /tmp/
28+
RUN if [ "$TARGETARCH" = "amd64" ]; then \
29+
cp /tmp/radar-agent-linux-musl /usr/local/bin/radar-agent || cp /tmp/radar-agent-linux /usr/local/bin/radar-agent; \
30+
elif [ "$TARGETARCH" = "arm64" ]; then \
31+
cp /tmp/radar-agent-linux-arm64 /usr/local/bin/radar-agent; \
32+
fi && \
33+
chmod +x /usr/local/bin/radar-agent && \
34+
rm -rf /tmp/radar-agent-*
35+
36+
USER appuser
37+
38+
# Environment defaults
39+
ENV AGENT_CONFIG=/etc/agent/config.yaml \
40+
AGENT_TLS_CERT=/certs/server.pem \
41+
AGENT_TLS_KEY=/certs/server.key
42+
43+
# Expose volumes for certs and config
44+
VOLUME ["/certs", "/etc/agent"]
45+
46+
# Healthcheck for orchestrators
47+
HEALTHCHECK --interval=30s --timeout=5s \
48+
CMD ["radar-agent", "--health"] || exit 1
49+
50+
ENTRYPOINT ["radar-agent"]
51+
CMD ["--config", "/etc/agent/config.yaml"]

docker/Dockerfile.multiplatform

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM debian:bookworm-slim
2+
3+
# TARGETARCH is automatically set by Docker buildx (amd64, arm64, etc.)
4+
ARG TARGETARCH
5+
6+
LABEL org.opencontainers.image.source="https://github.com/redis-field-engineering/radar-agent" \
7+
org.opencontainers.image.licenses="Redis, Inc." \
8+
org.opencontainers.image.authors="Radar Team"
9+
10+
# Install required packages
11+
RUN apt-get update && \
12+
apt-get install -y --no-install-recommends \
13+
libssl3 \
14+
ca-certificates \
15+
curl && \
16+
rm -rf /var/lib/apt/lists/* && \
17+
adduser --disabled-password --gecos "" appuser
18+
19+
# Create necessary directories
20+
RUN mkdir -p /certs /etc/agent /home/appuser/bin && \
21+
chown -R appuser:appuser /certs /etc/agent /home/appuser
22+
23+
# Copy default config (customers may override via volume)
24+
COPY --chown=appuser:appuser radar-agent-config-sample.yml /etc/agent/config.yaml
25+
26+
# Copy the correct binary based on architecture
27+
# For amd64: use radar-agent-linux
28+
# For arm64: use radar-agent-linux-arm64
29+
RUN if [ "$TARGETARCH" = "amd64" ]; then \
30+
echo "Using AMD64 binary"; \
31+
elif [ "$TARGETARCH" = "arm64" ]; then \
32+
echo "Using ARM64 binary"; \
33+
fi
34+
35+
COPY radar-agent-linux* /tmp/
36+
RUN if [ "$TARGETARCH" = "amd64" ]; then \
37+
cp /tmp/radar-agent-linux /usr/local/bin/radar-agent; \
38+
elif [ "$TARGETARCH" = "arm64" ]; then \
39+
cp /tmp/radar-agent-linux-arm64 /usr/local/bin/radar-agent; \
40+
fi && \
41+
chmod +x /usr/local/bin/radar-agent && \
42+
rm -rf /tmp/radar-agent-*
43+
44+
USER appuser
45+
46+
# Environment defaults
47+
ENV AGENT_CONFIG=/etc/agent/config.yaml \
48+
AGENT_TLS_CERT=/certs/server.pem \
49+
AGENT_TLS_KEY=/certs/server.key
50+
51+
# Expose volumes for certs and config
52+
VOLUME ["/certs", "/etc/agent"]
53+
54+
# Healthcheck for orchestrators
55+
HEALTHCHECK --interval=30s --timeout=5s \
56+
CMD ["radar-agent", "--health"] || exit 1
57+
58+
ENTRYPOINT ["radar-agent"]
59+
CMD ["--config", "/etc/agent/config.yaml"]

0 commit comments

Comments
 (0)