-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathContainerfile
76 lines (58 loc) · 2.77 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# vim: set filetype=dockerfile
ARG LIGHTSPEED_RAG_CONTENT_IMAGE=quay.io/openshift-lightspeed/lightspeed-rag-content@sha256:3e96332648a6f8ff1879c7ae11c818ea7f1c8d5b8a99c4bff406c98c8a7d4541
FROM ${LIGHTSPEED_RAG_CONTENT_IMAGE} as lightspeed-rag-content
FROM registry.redhat.io/ubi9/ubi-minimal@sha256:fb77e447ab97f3fecd15d2fa5361a99fe2f34b41422e8ebb3612eecd33922fa0
ARG VERSION
ARG APP_ROOT=/app-root
RUN microdnf install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs \
python3.11 python3.11-devel python3.11-pip
# tar gzip are required for OpenShift CLI installation
RUN microdnf install -y tar gzip
# conditional installation of OpenShift CLI
RUN if [ -f /cachi2/output/deps/generic/openshift-clients.tar.gz ]; then \
echo "Using pre-fetched OpenShift CLI from /cachi2"; \
tar -xvf /cachi2/output/deps/generic/openshift-clients.tar.gz -C /usr/local/bin; \
else \
OC_CLIENT_TAR_GZ=openshift-client-linux-amd64-rhel9-4.17.9.tar.gz; \
curl -LO "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/4.17.9/${OC_CLIENT_TAR_GZ}" && \
tar xvfz ${OC_CLIENT_TAR_GZ} -C /usr/local/bin && \
rm -f ${OC_CLIENT_TAR_GZ}; \
fi
# finish and verify installation
RUN chmod +x /usr/local/bin/oc
RUN microdnf remove -y tar gzip
RUN oc version --client
# PYTHONDONTWRITEBYTECODE 1 : disable the generation of .pyc
# PYTHONUNBUFFERED 1 : force the stdout and stderr streams to be unbuffered
# PYTHONCOERCECLOCALE 0, PYTHONUTF8 1 : skip legacy locales and use UTF-8 mode
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONCOERCECLOCALE=0 \
PYTHONUTF8=1 \
PYTHONIOENCODING=UTF-8 \
LANG=en_US.UTF-8 \
PIP_NO_CACHE_DIR=off
WORKDIR /app-root
COPY --from=lightspeed-rag-content /rag/vector_db/ocp_product_docs ./vector_db/ocp_product_docs
COPY --from=lightspeed-rag-content /rag/embeddings_model ./embeddings_model
# Add explicit files and directories
# (avoid accidental inclusion of local directories or env files or credentials)
COPY runner.py requirements.txt ./
RUN for a in 1 2 3 4 5; do pip3.11 install --no-cache-dir -r requirements.txt && break || sleep 15; done
COPY ols ./ols
# this directory is checked by ecosystem-cert-preflight-checks task in Konflux
COPY LICENSE /licenses/
# Run the application
EXPOSE 8080
EXPOSE 8443
CMD ["python3.11", "runner.py"]
LABEL io.k8s.display-name="OpenShift LightSpeed Service" \
io.k8s.description="AI-powered OpenShift Assistant Service." \
io.openshift.tags="openshift-lightspeed,ols" \
description="Red Hat OpenShift Lightspeed Service" \
summary="Red Hat OpenShift Lightspeed Service" \
com.redhat.component=openshift-lightspeed-service \
name=openshift-lightspeed-service \
vendor="Red Hat, Inc."
# no-root user is checked in Konflux
USER 1001