generated from codacy/codacy-public-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
34 lines (22 loc) · 810 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM golang:1.22-alpine as builder
ARG TRIVY_VERSION=dev
ENV TRIVY_VERSION=$TRIVY_VERSION
WORKDIR /src
COPY go.mod go.mod
COPY go.sum go.sum
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
RUN go mod verify
COPY cmd cmd
COPY internal internal
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod \
go build -o bin/codacy-trivy -ldflags="-s -w" ./cmd/tool
COPY docs docs
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod \
go run ./cmd/docgen
FROM busybox
RUN adduser -u 2004 -D docker
COPY --from=builder --chown=docker:docker /src/bin /dist/bin
COPY --from=builder --chown=docker:docker /src/docs /docs
COPY --chown=docker:docker cache/ /dist/cache/codacy-trivy
CMD [ "/dist/bin/codacy-trivy" ]