/
Dockerfile
40 lines (31 loc) · 1.07 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
# Stage 1: Use golang container as builder to build the target binaries
FROM golang:1.17 AS builder
ARG COMPONENT
WORKDIR /workspace/${COMPONENT}
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY Makefile Makefile
COPY cmd/ cmd/
COPY pkg/ pkg/
COPY datatypes/ datatypes/
COPY queries/ queries/
RUN make build
# Stage 2: Copy the binaries from the builder image to the base image
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
ARG COMPONENT
ENV USER_UID=1001
ENV USER_NAME=${COMPONENT}
# install operator binary
COPY --from=builder /workspace/${COMPONENT}/bin/${COMPONENT} /usr/local/bin/manager
# allow user to fully control the /usr/local/bin/resume directory (save resume files)
COPY web-templates/upload_resume.html /usr/local/bin/upload_resume.html
RUN mkdir /usr/local/bin/resume
RUN chown ${USER_UID}:0 /usr/local/bin/resume
RUN chmod 0755 /usr/local/bin/resume
COPY build/scripts/user_setup /usr/local/scripts/user_setup
RUN /usr/local/scripts/user_setup
RUN microdnf update && \
microdnf clean all
USER ${USER_UID}
ENTRYPOINT ["/usr/local/bin/manager"]