-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.scanner
42 lines (31 loc) · 1.63 KB
/
Dockerfile.scanner
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
35
36
37
38
39
40
41
42
# Copyright (C) 2024 Tim Bastin, l3montree UG (haftungsbeschränkt)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
FROM golang:1.23.1-alpine AS golang-builder
# set the working directory
WORKDIR /app
RUN apk add --no-cache curl
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.54.1
RUN curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64" && mv cosign-linux-amd64 /usr/local/bin/cosign && chmod +x /usr/local/bin/cosign
COPY . .
# build the scanner
RUN CGO_ENABLED=0 go build -o devguard-scanner ./cmd/devguard-scanner
# ----------------------
# create final image with node:alpine
FROM alpine:3.20.2@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
RUN apk add --no-cache git
COPY --from=golang-builder /app/devguard-scanner /usr/local/bin/devguard-scanner
COPY --from=golang-builder /usr/local/bin/trivy /usr/local/bin/trivy
COPY --from=golang-builder /usr/local/bin/cosign /usr/local/bin/cosign
ENTRYPOINT [""]