Caps for dockerfile
This commit is contained in:
@@ -1,39 +1,39 @@
|
|||||||
# Build stage for Linux
|
# Build stage for Linux
|
||||||
from rust:1-bookworm as linux-builder
|
FROM rust:1-bookworm as linux-builder
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
run apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y apt-transport-https && \
|
apt-get install -y apt-transport-https && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
workdir /app
|
WORKDIR /app
|
||||||
copy ./WatcherAgent/ .
|
COPY ./WatcherAgent/ .
|
||||||
|
|
||||||
# Build for Linux
|
# Build for Linux
|
||||||
run cargo build --release --target x86_64-unknown-linux-gnu
|
RUN cargo build --release --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
# Setze Berechtigungen für das Binary
|
# Setze Berechtigungen für das Binary
|
||||||
run chmod +x /app/target/x86_64-unknown-linux-gnu/release/$BINARY_NAME
|
RUN chmod +x /app/target/x86_64-unknown-linux-gnu/release/$BINARY_NAME
|
||||||
|
|
||||||
# Final Linux image
|
# Final Linux image
|
||||||
from debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
run apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y apt-transport-https && \
|
apt-get install -y apt-transport-https && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Make binary name configurable
|
# Make binary name configurable
|
||||||
arg BINARY_NAME
|
ARG BINARY_NAME
|
||||||
env BINARY_NAME=${BINARY_NAME:-WatcherAgent}
|
ENV BINARY_NAME=${BINARY_NAME:-WatcherAgent}
|
||||||
copy --from=linux-builder /app/target/x86_64-unknown-linux-gnu/release/${BINARY_NAME} /usr/local/bin/
|
COPY --from=linux-builder /app/target/x86_64-unknown-linux-gnu/release/${BINARY_NAME} /usr/local/bin/
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
healthcheck --interval=30s --timeout=3s \
|
HEALTHCHECK --interval=30s --timeout=3s \
|
||||||
cmd /usr/local/bin/${BINARY_NAME} healthcheck || exit 1
|
cmd /usr/local/bin/${BINARY_NAME} healthcheck || exit 1
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh", "-c", "/usr/local/bin/${BINARY_NAME}"]
|
ENTRYPOINT ["/bin/sh", "-c", "/usr/local/bin/${BINARY_NAME}"]
|
Reference in New Issue
Block a user