-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile.lemming
25 lines (21 loc) · 1010 Bytes
/
Dockerfile.lemming
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
FROM docker.io/golang:1.22-bookworm AS build
WORKDIR /build
COPY go.* ./
RUN go mod download
COPY . .
FROM build as release-build
RUN apt-get update && apt-get install -y libpcap-dev
RUN go install github.com/google/go-licenses@latest
RUN --mount=type=cache,target=/root/.cache/go-build go build -o /out/lemming ./cmd/lemming
RUN go-licenses save ./cmd/lemming --save_path THIRD_PARTY_LICENSES
FROM build as debug-build
RUN go install github.com/go-delve/delve/cmd/dlv@latest
RUN --mount=type=cache,target=/root/.cache/go-build go build -gcflags='all=-N -l' -o /out/lemming ./cmd/lemming
FROM docker.io/debian:bookworm as debug
RUN apt-get update && apt-get install -y libpcap-dev
COPY --from=debug-build /out/lemming /lemming/lemming
COPY --from=debug-build /go/bin/dlv /dlv/dlv
FROM docker.io/debian:bookworm as release
RUN apt-get update && apt-get install -y libpcap-dev
COPY --from=release-build /out/lemming /lemming/lemming
COPY --from=release-build /build/THIRD_PARTY_LICENSES /lemming/THIRD_PARTY