Skip to content

Commit 9e7dadd

Browse files
committed
add distros support
Signed-off-by: kerthcet <kerthcet@gmail.com>
1 parent 733cc64 commit 9e7dadd

6 files changed

Lines changed: 264 additions & 286 deletions

File tree

Dockerfile.alpine

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Multi-stage build for SandD daemon - Alpine Linux (musl-based)
2+
# Build with musl target for Alpine compatibility
3+
FROM rust:1.85-alpine as builder
4+
5+
WORKDIR /app
6+
7+
# Install build dependencies for Alpine
8+
RUN apk add --no-cache \
9+
musl-dev \
10+
pkgconfig \
11+
openssl-dev \
12+
openssl-libs-static
13+
14+
# Copy workspace files
15+
COPY Cargo.toml Cargo.lock ./
16+
COPY sandd/ ./sandd/
17+
COPY server/ ./server/
18+
19+
# Build the daemon binary in release mode
20+
# Alpine uses musl libc, which is already the default target
21+
RUN cargo build --package sandd --release
22+
23+
# Runtime stage - Alpine for minimal size
24+
FROM alpine:3.21
25+
26+
# Install runtime dependencies
27+
RUN apk add --no-cache \
28+
ca-certificates \
29+
libgcc
30+
31+
# Copy the binary from builder
32+
COPY --from=builder /app/target/release/sandd /usr/local/bin/sandd
33+
34+
# Set working directory
35+
WORKDIR /workspace
36+
37+
# Default command - can be overridden
38+
ENTRYPOINT ["/usr/local/bin/sandd"]
39+
CMD ["--help"]
File renamed without changes.

Dockerfile.rocky

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Multi-stage build for SandD daemon - Rocky Linux (RHEL-based)
2+
# Use Rust builder stage
3+
FROM rust:1.85-slim as builder
4+
5+
WORKDIR /app
6+
7+
# Install build dependencies
8+
RUN apt-get update && apt-get install -y \
9+
pkg-config \
10+
libssl-dev \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# Copy workspace files
14+
COPY Cargo.toml Cargo.lock ./
15+
COPY sandd/ ./sandd/
16+
COPY server/ ./server/
17+
18+
# Build the daemon binary in release mode
19+
RUN cargo build --package sandd --release
20+
21+
# Runtime stage - Rocky Linux 9
22+
FROM rockylinux:9-minimal
23+
24+
# Install runtime dependencies
25+
RUN microdnf install -y \
26+
ca-certificates \
27+
openssl-libs \
28+
&& microdnf clean all
29+
30+
# Copy the binary from builder
31+
COPY --from=builder /app/target/release/sandd /usr/local/bin/sandd
32+
33+
# Set working directory
34+
WORKDIR /workspace
35+
36+
# Default command - can be overridden
37+
ENTRYPOINT ["/usr/local/bin/sandd"]
38+
CMD ["--help"]

docker-compose.e2e.yml

Lines changed: 85 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
version: '3.8'
22

33
services:
4-
# The daemon running in a container
5-
daemon1:
4+
# Debian-based daemons
5+
daemon-debian-1:
66
build:
77
context: .
8-
dockerfile: Dockerfile.e2e
9-
container_name: sandd-daemon-1
8+
dockerfile: Dockerfile.debian
9+
container_name: sandd-daemon-debian-1
1010
command: >
1111
--server-url ws://host.docker.internal:8765/ws
12-
--daemon-id daemon-1
12+
--daemon-id daemon-debian-1
1313
--label env=test
14+
--label distro=debian
1415
--label region=us-east
1516
networks:
1617
- sandd-network
@@ -23,15 +24,16 @@ services:
2324
timeout: 3s
2425
retries: 3
2526

26-
daemon2:
27+
daemon-debian-2:
2728
build:
2829
context: .
29-
dockerfile: Dockerfile.e2e
30-
container_name: sandd-daemon-2
30+
dockerfile: Dockerfile.debian
31+
container_name: sandd-daemon-debian-2
3132
command: >
3233
--server-url ws://host.docker.internal:8765/ws
33-
--daemon-id daemon-2
34+
--daemon-id daemon-debian-2
3435
--label env=test
36+
--label distro=debian
3537
--label region=us-west
3638
networks:
3739
- sandd-network
@@ -44,15 +46,17 @@ services:
4446
timeout: 3s
4547
retries: 3
4648

47-
daemon3:
49+
# Alpine-based daemons
50+
daemon-alpine-1:
4851
build:
4952
context: .
50-
dockerfile: Dockerfile.e2e
51-
container_name: sandd-daemon-3
53+
dockerfile: Dockerfile.alpine
54+
container_name: sandd-daemon-alpine-1
5255
command: >
5356
--server-url ws://host.docker.internal:8765/ws
54-
--daemon-id daemon-3
55-
--label env=prod
57+
--daemon-id daemon-alpine-1
58+
--label env=test
59+
--label distro=alpine
5660
--label region=eu-west
5761
networks:
5862
- sandd-network
@@ -65,6 +69,73 @@ services:
6569
timeout: 3s
6670
retries: 3
6771

72+
daemon-alpine-2:
73+
build:
74+
context: .
75+
dockerfile: Dockerfile.alpine
76+
container_name: sandd-daemon-alpine-2
77+
command: >
78+
--server-url ws://host.docker.internal:8765/ws
79+
--daemon-id daemon-alpine-2
80+
--label env=prod
81+
--label distro=alpine
82+
--label region=ap-south
83+
networks:
84+
- sandd-network
85+
extra_hosts:
86+
- "host.docker.internal:host-gateway"
87+
restart: unless-stopped
88+
healthcheck:
89+
test: ["CMD", "pgrep", "-f", "sandd"]
90+
interval: 5s
91+
timeout: 3s
92+
retries: 3
93+
94+
# Rocky Linux-based daemons
95+
daemon-rocky-1:
96+
build:
97+
context: .
98+
dockerfile: Dockerfile.rocky
99+
container_name: sandd-daemon-rocky-1
100+
command: >
101+
--server-url ws://host.docker.internal:8765/ws
102+
--daemon-id daemon-rocky-1
103+
--label env=prod
104+
--label distro=rocky
105+
--label region=eu-central
106+
networks:
107+
- sandd-network
108+
extra_hosts:
109+
- "host.docker.internal:host-gateway"
110+
restart: unless-stopped
111+
healthcheck:
112+
test: ["CMD", "pgrep", "-f", "sandd"]
113+
interval: 5s
114+
timeout: 3s
115+
retries: 3
116+
117+
daemon-rocky-2:
118+
build:
119+
context: .
120+
dockerfile: Dockerfile.rocky
121+
container_name: sandd-daemon-rocky-2
122+
command: >
123+
--server-url ws://host.docker.internal:8765/ws
124+
--daemon-id daemon-rocky-2
125+
--label env=test
126+
--label distro=rocky
127+
--label region=ap-northeast
128+
networks:
129+
- sandd-network
130+
extra_hosts:
131+
- "host.docker.internal:host-gateway"
132+
restart: unless-stopped
133+
healthcheck:
134+
test: ["CMD", "pgrep", "-f", "sandd"]
135+
interval: 5s
136+
timeout: 3s
137+
retries: 3
138+
68139
networks:
69140
sandd-network:
70141
driver: bridge

0 commit comments

Comments
 (0)