-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance Dockerfile adding multistage build (#47)
- Loading branch information
1 parent
5a51292
commit a57a990
Showing
3 changed files
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
FROM golang:1.19-buster AS build | ||
|
||
WORKDIR /app | ||
|
||
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/static:nonroot | ||
|
||
COPY dependency-track-exporter / | ||
WORKDIR / | ||
|
||
COPY --from=build /dependency-track-exporter /dependency-track-exporter | ||
|
||
EXPOSE 9916 | ||
|
||
USER nonroot:nonroot | ||
|
||
USER nonroot | ||
ENTRYPOINT ["/dependency-track-exporter"] | ||
ENTRYPOINT ["/dependency-track-exporter"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM gcr.io/distroless/static:nonroot | ||
|
||
COPY dependency-track-exporter / | ||
|
||
USER nonroot | ||
|
||
ENTRYPOINT ["/dependency-track-exporter"] |