-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
48 lines (37 loc) · 1.62 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
ARG BUILDIMG=registry.access.redhat.com/ubi9-minimal
ARG RUNIMG=registry.access.redhat.com/ubi9-minimal
# ---------------------------------------
# build image
FROM ${BUILDIMG} as buildimg
WORKDIR /vuln4shift
USER root
RUN microdnf install -y golang git-core
ADD go.mod /vuln4shift/
ADD go.sum /vuln4shift/
RUN go mod download
ADD main.go /vuln4shift/
ADD base /vuln4shift/base
ADD dbadmin /vuln4shift/dbadmin
ADD manager /vuln4shift/manager
ADD pyxis /vuln4shift/pyxis
ADD digestwriter /vuln4shift/digestwriter
ADD scripts /vuln4shift/scripts
ADD test /vuln4shift/test
ADD vmsync /vuln4shift/vmsync
ADD cleaner /vuln4shift/cleaner
ADD expsync /vuln4shift/expsync
ARG VERSION=dev
# install swag command to generate swagger
RUN go install github.com/swaggo/swag/cmd/swag@latest
RUN mkdir ./manager/docs
RUN bash ./scripts/generate_swagger.sh
RUN go build -ldflags "-X app/manager.Version=$VERSION" -v main.go
# ---------------------------------------
# runtime image
FROM ${RUNIMG} as runtimeimg
WORKDIR /vuln4shift
USER 1001
COPY --from=buildimg /vuln4shift/main /vuln4shift/
COPY --from=buildimg /vuln4shift/dbadmin/migrations /vuln4shift/dbadmin/migrations
COPY --from=buildimg /vuln4shift/manager/docs/swagger.json /vuln4shift/manager/docs/swagger.json
COPY --from=buildimg /vuln4shift/pyxis/profiles.yml /vuln4shift/pyxis/profiles.yml