generated from honeycombio/.github
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
26 lines (24 loc) · 963 Bytes
/
Dockerfile
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
# uses docker multi-stage builds: https://docs.docker.com/build/building/multi-stage/
# base stage builds the agent binary for use in later stages
FROM golang:1.21 as base
RUN apt update -yq && \
apt install -yq make libpcap-dev
WORKDIR /src
COPY go.* .
RUN go mod download
COPY . .
RUN make build
# run tests with 'docker build --target test .'; skips the runnable image build
FROM base as test
RUN make test
# last unnamed stage is the default target for any image build
# this produces the runnable agent image
# the --no-install-recommends flag is used to avoid installing unnecessary packages
# apt-get clean is used to remove cached package files after installation
FROM ubuntu:22.04
RUN apt-get update -yq && \
apt-get install -yq --no-install-recommends ca-certificates libpcap-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=base /src/hny-network-agent /bin/hny-network-agent
ENTRYPOINT [ "/bin/hny-network-agent" ]