Skip to content

Commit

Permalink
fix the pdf reporter docker
Browse files Browse the repository at this point in the history
  • Loading branch information
dlicheva committed Jan 17, 2025
1 parent 6637ce9 commit ecf40fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 8 additions & 5 deletions new-components/reporters/pdf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ WORKDIR /workdir
# Install Playwright CLI with the correct version
RUN go install github.com/playwright-community/playwright-go/cmd/playwright@v0.4702.0
# Build your Go application
#ENTRYPOINT ["tail", "-f", "/dev/null"]
RUN GOOS=linux GOARCH=amd64 go build -o /bin/reporter cmd/main.go

# Stage 3: Final image
FROM ubuntu:22.04

COPY --from=builder /go/bin/playwright /bin/reporter /
RUN apt-get update && apt-get install -y ca-certificates tzdata \
# Install dependencies and all browsers (or specify one)
&& /playwright install chromium --with-deps \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update
RUN apt-get install -y ca-certificates tzdata
RUN ./playwright install --with-deps
RUN rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["tail", "-f", "/dev/null"]

CMD ["/reporter"]
6 changes: 6 additions & 0 deletions new-components/reporters/pdf/internal/reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,30 @@ func (p pdfReporter) Report(
findings []*vf.VulnerabilityFinding,
) error {
//todo: add logging to each step
logger := component.
LoggerFromContext(ctx)
logger.Info("start pdf consumer")

// get parameters
config, err := newPdfConfig()
if err != nil {
return errors.Errorf("could not get .env config: %w", err)
}
logger.Info("got params")

// get formatted scan results
findingStrings, err := getScanResults(ctx, findings)
if err != nil {
return errors.Errorf("could not get the scan results: %w", err)
}
logger.Info("got findingStrings")

// get the PDF
resultFilename, pdfBytes, err := getPdf(findingStrings)
if err != nil {
return fmt.Errorf("could not build pdf: %w", err)
}
logger.Info("got pdf")

// upload the pdf to the s3 if needed
if !config.skipS3Upload {
Expand Down

0 comments on commit ecf40fa

Please sign in to comment.