aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 0702a01f5a87147e841dbd5ce97b0691c6a13b03 (plain)
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
FROM rust:1.86-alpine3.21 AS build-env

WORKDIR /build

# the rust container is literally incomplete lol
# https://stackoverflow.com/a/74309414
RUN apk add --no-cache musl-dev

# for layer caching, first only build the deps, so that changes to literally anything else don't invalidate the cache
RUN mkdir src
RUN echo 'fn main() {}' > src/main.rs
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release

# copy in the real source
RUN rm src/*.rs
COPY src src
COPY build.rs ./

# this builds a release binary
RUN cargo build --release

FROM alpine:3.21

COPY --from=build-env /build/target/release/containerspy /usr/bin/containerspy

# for mounting config.json into
RUN mkdir /etc/containerspy

ENTRYPOINT ["containerspy"]
STOPSIGNAL SIGINT