-
Notifications
You must be signed in to change notification settings - Fork 1
/
Containerfile
36 lines (31 loc) · 1 KB
/
Containerfile
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
# We do a two stage build
FROM golang:1.21 as builder
WORKDIR /build
COPY . .
# Do some GO optimization
ARG VERSION=main
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
# Let's build it! :-)
RUN go build -a -o scapinoculars .
# Now let's assemble the image
FROM registry.access.redhat.com/ubi9/ubi-minimal
# We need the openscap-scanner package to generate the fancy
# HTML reports
RUN microdnf install -y openscap-scanner
# Let's put everything in /opt/go because why not
WORKDIR /opt/go
# Copy the binary from the builder image
COPY --from=builder /build/scapinoculars .
# Copy the Go templates, but this time from the repository
COPY ./templates ./templates
# Copy CSS, so that the reports are beautiful in offline environments
ADD --chmod=644 https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css ./styles/
# We are using port 2112, also because why not
EXPOSE 2112
# We don't need root privileges, yay!
USER 1001
# And we launch the binary!
CMD ["/opt/go/scapinoculars"]