Skip to content

Commit fb50016

Browse files
Merge pull request #22 from redis-field-engineering/feat/add-arm64-support
feat: add ARM64 multi-platform Docker image support
2 parents d7200f6 + 238de49 commit fb50016

File tree

3 files changed

+156
-18
lines changed

3 files changed

+156
-18
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ 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
37+
radar-agent-linux-arm64-musl
38+
cp ./binaries/radar-agent-linux-arm64-musl/radar-agent-linux-arm64-musl ./radar-agent-linux-arm64-musl
3639
cp ./binaries/radar-agent-darwin/radar-agent-darwin ./radar-agent-darwin
3740
3841
# Make binaries executable
@@ -51,6 +54,8 @@ jobs:
5154
path: |
5255
radar-agent-linux
5356
radar-agent-linux-musl
57+
radar-agent-linux-arm64
58+
radar-agent-linux-arm64-musl
5459
radar-agent-darwin
5560
retention-days: 1
5661

@@ -68,6 +73,9 @@ jobs:
6873
name: agent-binaries
6974
path: ./
7075

76+
- name: Set up QEMU
77+
uses: docker/setup-qemu-action@v3
78+
7179
- name: Set up Docker Buildx
7280
uses: docker/setup-buildx-action@v3
7381

@@ -98,33 +106,31 @@ jobs:
98106
run: |
99107
echo "tag_name=${{ github.event.client_payload.ref }}" >> $GITHUB_OUTPUT
100108
101-
- name: Build and push Debian image
109+
- name: Build and push multi-platform Debian image
102110
uses: docker/build-push-action@v5
103111
with:
104112
context: .
105-
file: ./docker/Dockerfile
106-
build-args: |
107-
BINARY=radar-agent-linux
113+
file: ./docker/Dockerfile.multiplatform
108114
push: true
109115
tags: |
116+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag_name }}
117+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
110118
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:debian-${{ steps.tag.outputs.tag_name }}
111119
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:debian-latest
112120
labels: ${{ steps.meta.outputs.labels }}
113-
platforms: linux/amd64
121+
platforms: linux/amd64,linux/arm64
114122

115-
- name: Build and push Alpine image
123+
- name: Build and push multi-platform Alpine image
116124
uses: docker/build-push-action@v5
117125
with:
118126
context: .
119-
file: ./docker/Dockerfile.alpine
120-
build-args: |
121-
BINARY=radar-agent-linux-musl
127+
file: ./docker/Dockerfile.alpine.multiplatform
122128
push: true
123129
tags: |
124130
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${{ steps.tag.outputs.tag_name }}
125131
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-latest
126132
labels: ${{ steps.meta.outputs.labels }}
127-
platforms: linux/amd64
133+
platforms: linux/amd64,linux/arm64
128134

129135
release:
130136
name: Create Release
@@ -156,7 +162,7 @@ jobs:
156162
run: |
157163
# Create and explicitly sign the tag with -s flag
158164
git tag -s ${{ steps.tag.outputs.tag_name }} -m "Release ${{ steps.tag.outputs.tag_name }}" --force
159-
165+
160166
# Push the signed tag to the repository
161167
git push origin ${{ steps.tag.outputs.tag_name }} --force
162168
@@ -168,24 +174,36 @@ jobs:
168174
files: |
169175
radar-agent-linux
170176
radar-agent-linux-musl
177+
radar-agent-linux-arm64
178+
radar-agent-linux-arm64-musl
171179
radar-agent-darwin
172180
make_latest: true
173181
body: |
174182
## Radar Agent Release ${{ steps.tag.outputs.tag_name }}
175183
176184
### Quick Install
177185
178-
**Linux (glibc):**
186+
**Linux AMD64 (glibc):**
179187
```bash
180188
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux" -o radar-agent
181189
```
182190
183-
**Linux (musl):**
191+
**Linux AMD64 (musl):**
184192
```bash
185193
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-musl" -o radar-agent
186194
```
187195
188-
**macOS:**
196+
**Linux ARM64 (glibc):**
197+
198+
**Linux ARM64 (musl - for Alpine):**
199+
```bash
200+
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-arm64-musl" -o radar-agent
201+
```
202+
```bash
203+
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-arm64" -o radar-agent
204+
```
205+
206+
**macOS (Apple Silicon):**
189207
```bash
190208
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-darwin" -o radar-agent
191209
```
@@ -196,13 +214,25 @@ jobs:
196214
sudo cp radar-agent /usr/local/bin/radar-agent
197215
```
198216
199-
**Docker:**
217+
**Docker (Multi-Platform - AMD64 & ARM64):**
200218
```bash
201-
# Alpine (recommended)
202-
docker pull ghcr.io/redis-field-engineering/radar-agent:alpine-${{ steps.tag.outputs.tag_name }}
219+
# Latest (Debian-based, works on both AMD64 and ARM64)
220+
docker pull ghcr.io/redis-field-engineering/radar-agent:latest
221+
222+
# Specific version
223+
docker pull ghcr.io/redis-field-engineering/radar-agent:${{ steps.tag.outputs.tag_name }}
203224
225+
# Alpine (recommended for minimal size)
226+
docker pull ghcr.io/redis-field-engineering/radar-agent:alpine-latest
227+
204228
# Debian
205-
docker pull ghcr.io/redis-field-engineering/radar-agent:debian-${{ steps.tag.outputs.tag_name }}
229+
docker pull ghcr.io/redis-field-engineering/radar-agent:debian-latest
206230
```
231+
232+
### Platform Support
233+
234+
- **AMD64 (x86_64)**: All binaries and Docker images
235+
- **ARM64 (aarch64)**: Native binary + multi-platform Docker images
236+
- **Apple Silicon (M1/M2/M3)**: Native macOS binary + ARM64 Docker images
207237
env:
208238
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
adduser -D -g "" appuser
15+
16+
# Create necessary directories
17+
RUN mkdir -p /certs /etc/agent /home/appuser/bin && \
18+
chown -R appuser:appuser /certs /etc/agent /home/appuser
19+
20+
# Copy default config (customers may override via volume)
21+
COPY --chown=appuser:appuser radar-agent-config-sample.yml /etc/agent/config.yaml
22+
23+
# Copy the correct binary based on architecture
24+
# For Alpine, we use musl binaries for both AMD64 and ARM64
25+
COPY radar-agent-linux* /tmp/
26+
RUN if [ "$TARGETARCH" = "amd64" ]; then \
27+
cp /tmp/radar-agent-linux-musl /usr/local/bin/radar-agent; \
28+
elif [ "$TARGETARCH" = "arm64" ]; then \
29+
cp /tmp/radar-agent-linux-arm64-musl /usr/local/bin/radar-agent; \
30+
fi && \
31+
chmod +x /usr/local/bin/radar-agent && \
32+
rm -rf /tmp/radar-agent-*
33+
34+
USER appuser
35+
36+
# Environment defaults
37+
ENV AGENT_CONFIG=/etc/agent/config.yaml \
38+
AGENT_TLS_CERT=/certs/server.pem \
39+
AGENT_TLS_KEY=/certs/server.key
40+
41+
# Expose volumes for certs and config
42+
VOLUME ["/certs", "/etc/agent"]
43+
44+
# Healthcheck for orchestrators
45+
HEALTHCHECK --interval=30s --timeout=5s \
46+
CMD ["radar-agent", "--health"] || exit 1
47+
48+
ENTRYPOINT ["radar-agent"]
49+
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)