38 lines
1.9 KiB
Docker
38 lines
1.9 KiB
Docker
# Build stage for Linux
|
|
from rust:1.70 as linux-builder
|
|
|
|
# Install dependencies
|
|
run apt-get update && \
|
|
apt-get install -y apt-transport-https && \
|
|
apt-get install -y \
|
|
libssl-dev \
|
|
pkg-config \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
workdir /app
|
|
copy . .
|
|
|
|
# Build for Linux
|
|
run cargo build --release --target x86_64-unknown-linux-gnu
|
|
|
|
# Final Linux image
|
|
from debian:bullseye-slim
|
|
|
|
run apt-get update && \
|
|
apt-get install -y apt-transport-https && \
|
|
apt-get install -y \
|
|
libssl-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Make binary name configurable
|
|
arg BINARY_NAME=WatcherAgent
|
|
copy --from=linux-builder /app/target/x86_64-unknown-linux-gnu/release/$BINARY_NAME /usr/local/bin/
|
|
|
|
# Verify binary works
|
|
run /usr/local/bin/$BINARY_NAME --version
|
|
|
|
# Health check
|
|
healthcheck --interval=30s --timeout=3s \
|
|
cmd /usr/local/bin/$BINARY_NAME healthcheck || exit 1
|
|
|
|
entrypoint ["/usr/local/bin/$BINARY_NAME"] |