Skip to content

Commit

Permalink
Enhance Dockerfile adding multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioasantiago committed Jan 31, 2023
1 parent 0a8be94 commit 9fcb619
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
FROM gcr.io/distroless/static:nonroot
FROM golang:1.19-buster AS build

COPY dependency-track-exporter /
WORKDIR /app

USER nonroot
ENTRYPOINT ["/dependency-track-exporter"]
COPY go.mod ./

COPY go.sum ./

RUN go mod download

COPY *.go ./

COPY internal ./internal

RUN go build -o /dependency-track-exporter

FROM gcr.io/distroless/base-debian11:latest-amd64

WORKDIR /

COPY --from=build /dependency-track-exporter /dependency-track-exporter

EXPOSE 9916

USER nonroot:nonroot

ENTRYPOINT ["/dependency-track-exporter"]

0 comments on commit 9fcb619

Please sign in to comment.