forked from redhat-best-practices-for-k8s/oct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.local
53 lines (42 loc) · 1.54 KB
/
Dockerfile.local
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
49
50
51
52
53
FROM registry.access.redhat.com/ubi8/ubi:8.9-1028 AS builder
ARG OCT_LOCAL_FOLDER
ENV OCT_FOLDER=/usr/oct
ENV OCT_DB_FOLDER=${OCT_FOLDER}/cmd/tnf/fetch/data
# Install dependencies
RUN yum install -y gcc git jq make wget
# Install Go binary
ENV GO_DL_URL="https://golang.org/dl"
ENV GO_BIN_TAR="go1.21.4.linux-amd64.tar.gz"
ENV GO_BIN_URL_x86_64=${GO_DL_URL}/${GO_BIN_TAR}
ENV GOPATH="/root/go"
RUN if [[ "$(uname -m)" -eq "x86_64" ]] ; then \
wget --directory-prefix=${TEMP_DIR} ${GO_BIN_URL_x86_64} && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf ${TEMP_DIR}/${GO_BIN_TAR}; \
else \
echo "CPU architecture not supported" && exit 1; \
fi
# Add go binary directory to $PATH
ENV PATH=${PATH}:"/usr/local/go/bin":${GOPATH}/"bin"
WORKDIR /root
RUN echo "Coyping OCT from local folder ${OCT_LOCAL_FOLDER}"
COPY ${OCT_LOCAL_FOLDER} .
RUN make build-oct && \
mkdir -p ${OCT_FOLDER} && \
mkdir -p ${OCT_DB_FOLDER} && \
ls -la ${OCT_FOLDER} && \
cp oct ${OCT_FOLDER} && \
ls -la ${OCT_FOLDER}/*
RUN ./oct fetch --operator --container --helm && \
ls -laR cmd/tnf/fetch/data/* && \
cp -a cmd/tnf/fetch/data/* ${OCT_DB_FOLDER} && \
cp scripts/run.sh ${OCT_FOLDER} && \
chmod -R 777 ${OCT_DB_FOLDER}
# Copy the state into a new flattened image to reduce (layers) size.
# It should also hide the pull token.
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
ENV OCT_FOLDER=/usr/oct
COPY --from=builder ${OCT_FOLDER} ${OCT_FOLDER}
WORKDIR ${OCT_FOLDER}
ENV SHELL=/bin/bash
CMD ["./run.sh"]