github.com/honeycombio/honeytail@v1.9.0/Dockerfile (about)

     1  # This builds the binary inside an Alpine Linux container, which is small
     2  FROM alpine:3.16
     3  
     4  # Set us up so we can build the binary
     5  ENV GOROOT /usr/lib/go
     6  ENV GOPATH /gopath
     7  ENV GOBIN /gopath/bin
     8  ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin
     9  
    10  WORKDIR /gopath/src/github.com/honeycombio/honeytail
    11  COPY . /gopath/src/github.com/honeycombio/honeytail/
    12  
    13  # Does the package, build, and cleanup as one step to keep size small
    14  RUN apk add --update \
    15          coreutils \
    16          go \
    17          git \
    18          openssl \
    19          ca-certificates \
    20          musl-dev \
    21      && ver=$(git rev-parse --short HEAD) \
    22      && git clean -f \
    23      && rm -rf .git \
    24      && go install -ldflags="-X main.BuildID=${ver}" github.com/honeycombio/honeytail \
    25      && apk del git go \
    26      && rm -rf /var/cache/apk/*
    27  
    28  ENV HONEYCOMB_WRITE_KEY NULL
    29  ENV NGINX_LOG_FORMAT_NAME combined
    30  ENV NGINX_CONF /etc/nginx.conf
    31  ENV HONEYCOMB_SAMPLE_RATE 1
    32  ENV NGINX_ACCESS_LOG_FILENAME access.log
    33  
    34  CMD [ "/bin/sh", "-c", "honeytail \
    35              --parser nginx \
    36              --writekey $HONEYCOMB_WRITE_KEY \
    37              --file /var/log/nginx/$NGINX_ACCESS_LOG_FILENAME \
    38              --dataset nginx \
    39              --samplerate $HONEYCOMB_SAMPLE_RATE \
    40              --nginx.conf $NGINX_CONF \
    41              --nginx.format $NGINX_LOG_FORMAT_NAME \
    42              --tail.read_from end" ]