-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (40 loc) · 1.22 KB
/
Dockerfile
File metadata and controls
52 lines (40 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Build stage
FROM rust:latest AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && \
apt-get install -y \
cmake \
build-essential \
pkg-config \
libssl-dev \
ca-certificates \
libclang-dev \
clang \
&& rm -rf /var/lib/apt/lists/*
# Find and set LIBCLANG_PATH
RUN find /usr -name "libclang.so*" -exec dirname {} \; | head -n 1 > /tmp/libclang_path && \
export LIBCLANG_PATH=$(cat /tmp/libclang_path) && \
echo "LIBCLANG_PATH=$LIBCLANG_PATH" >> /etc/environment
# Copy only the dependency files first (for layer caching)
COPY Cargo.toml Cargo.lock ./
# Create dummy source to cache dependencies
RUN mkdir -p src && \
echo "fn main() {}" > src/main.rs && \
. /etc/environment && \
cargo build --release && \
rm -rf src
# Now copy the actual source code
COPY src/ ./src/
# Build the main application
RUN . /etc/environment && \
cargo build --release
# Runtime stage
FROM gcr.io/distroless/cc-debian12
WORKDIR /app
# Copy the compiled binary from builder
COPY --from=builder /app/target/release/SoundRelay /app/SoundRelay
# Expose ports: UDP for audio, TCP for control/metrics
EXPOSE 4000/udp 4300/tcp
# Set the entrypoint
ENTRYPOINT ["/app/SoundRelay"]