Skip to content

Commit

Permalink
Optimize docker image (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmachard authored Dec 4, 2023
1 parent 4b16f8a commit 57d3124
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ ARG VERSION

WORKDIR /build
COPY . .
RUN apk add git
RUN CGO_ENABLED=0 go build -ldflags="-s -w -X 'github.com/prometheus/common/version.Version=$VERSION'"
RUN apk add git \
&& CGO_ENABLED=0 go build -ldflags="-s -w -X 'github.com/prometheus/common/version.Version=$VERSION'"


FROM alpine:3.18.4

RUN apk add --no-cache tzdata
RUN mkdir -p /etc/dnscollector/ /var/dnscollector/
RUN apk add --no-cache tzdata \
&& mkdir -p /etc/dnscollector/ /var/dnscollector/ \
&& addgroup -g 1000 dnscollector && adduser -D -H -G dnscollector -u 1000 -S dnscollector \
&& chown dnscollector:dnscollector /var/dnscollector /etc/dnscollector

USER dnscollector

COPY --from=builder /build/go-dnscollector /bin/go-dnscollector
COPY --from=builder /build/config.yml ./etc/dnscollector/config.yml

RUN addgroup -g 1000 dnscollector && adduser -D -H -G dnscollector -u 1000 -S dnscollector
RUN chown dnscollector:dnscollector /var/dnscollector /etc/dnscollector
USER dnscollector

EXPOSE 6000/tcp 8080/tcp

ENTRYPOINT ["/bin/go-dnscollector"]
Expand Down

0 comments on commit 57d3124

Please sign in to comment.