-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) · 905 Bytes
/
Dockerfile
File metadata and controls
33 lines (25 loc) · 905 Bytes
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
32
33
# Build stage
FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git
WORKDIR /src
COPY . .
RUN ver=$(git describe --tags --match='v[0-9]*' --always) \
&& go build -ldflags="-X main.BuildID=${ver}" -o /honeytail .
# Runtime stage
FROM alpine:3.21
RUN apk add --no-cache ca-certificates
COPY --from=builder /honeytail /usr/local/bin/honeytail
ENV HONEYCOMB_WRITE_KEY=NULL
ENV NGINX_LOG_FORMAT_NAME=combined
ENV NGINX_CONF=/etc/nginx.conf
ENV HONEYCOMB_SAMPLE_RATE=1
ENV NGINX_ACCESS_LOG_FILENAME=access.log
CMD [ "/bin/sh", "-c", "honeytail \
--parser nginx \
--writekey $HONEYCOMB_WRITE_KEY \
--file /var/log/nginx/$NGINX_ACCESS_LOG_FILENAME \
--dataset nginx \
--samplerate $HONEYCOMB_SAMPLE_RATE \
--nginx.conf $NGINX_CONF \
--nginx.format $NGINX_LOG_FORMAT_NAME \
--tail.read_from end" ]