Skip to content

Commit

Permalink
Merge pull request #9 from FortnoxAB/curantes-patch-2
Browse files Browse the repository at this point in the history
Build static and set correct permissions
  • Loading branch information
curantes authored Apr 25, 2023
2 parents cfa8cf5 + e87da3b commit fdb851c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM golang:1.20-alpine AS build
ENV CGO_ENABLED=0
RUN mkdir /src
WORKDIR /src
COPY *.go go.mod go.sum /src/
RUN apk add git
RUN go build .

FROM gcr.io/distroless/static-debian11:nonroot
COPY --from=build /src/exporter_exporter /usr/bin/
COPY k8s.yml /expexp.yaml
COPY --from=build --chown=nonroot:nonroot /src/exporter_exporter /home/nonroot/exporter_exporter
COPY --chown=nonroot:nonroot k8s.yml /home/nonroot/expexp.yaml
USER nonroot
ENTRYPOINT ["/usr/bin/exporter_exporter"]
WORKDIR /home/nonroot
ENTRYPOINT ["/home/nonroot/exporter_exporter"]

0 comments on commit fdb851c

Please sign in to comment.