1
+ ARG BUILD_ENV=prod
1
2
ARG BASE=registry.access.redhat.com/ubi9/ubi:9.5-1732804088
2
- FROM $BASE
3
+
4
+ FROM $BASE as build_prod
5
+ ONBUILD COPY ./requirements/requirements_ubi9.txt /root/requirements_ubi9.txt
6
+
7
+ FROM $BASE as build_test
8
+ ONBUILD COPY ./requirements/requirements_ubi.in /root/requirements_ubi.in
9
+
10
+ FROM $BASE as build_custom
11
+ ONBUILD COPY ./requirements/requirements.in /root/requirements.in
12
+
13
+ FROM build_${BUILD_ENV}
14
+
15
+ ARG BUILD_ENV
16
+ ARG BASE
3
17
4
18
LABEL com.ibm.name="IBM Storage Scale bridge for Grafana"
5
19
LABEL com.ibm.vendor="IBM"
@@ -26,11 +40,9 @@ ENV GID=$GROUPID
26
40
27
41
ARG HTTPPROTOCOL=http
28
42
ENV PROTOCOL=$HTTPPROTOCOL
29
- RUN echo "the HTTP/S protocol is set to $PROTOCOL"
30
43
31
44
ARG HTTPBASICAUTH=True
32
45
ENV BASICAUTH=$HTTPBASICAUTH
33
- RUN echo "the HTTP/S basic authentication is set to $BASICAUTH"
34
46
35
47
ARG AUTHUSER=None
36
48
ENV BASICAUTHUSER=$AUTHUSER
@@ -40,15 +52,12 @@ ENV BASICAUTHPASSW=$AUTHPASSW
40
52
41
53
ARG HTTPPORT=None
42
54
ENV PORT=$HTTPPORT
43
- RUN echo "the OpentTSDB API HTTP/S port is set to $PORT"
44
55
45
56
ARG PROMPORT=None
46
- ENV PROMETHEUS=$PROMPORT
47
- RUN echo "the Prometheus API HTTPS port is set to $PROMETHEUS"
57
+ ENV PROMETHEUS=$PROMPORT
48
58
49
59
ARG PERFMONPORT=9980
50
60
ENV SERVERPORT=$PERFMONPORT
51
- RUN echo "the PERFMONPORT port is set to $SERVERPORT"
52
61
53
62
ARG CERTPATH='/etc/bridge_ssl/certs'
54
63
ENV TLSKEYPATH=$CERTPATH
@@ -67,27 +76,33 @@ ENV APIKEYVALUE=$KEYVALUE
67
76
68
77
ARG PMCOLLECTORIP=0.0.0.0
69
78
ENV SERVER=$PMCOLLECTORIP
70
- RUN echo "the pmcollector server ip is set to $SERVER"
71
79
72
80
ARG DEFAULTLOGPATH='/var/log/ibm_bridge_for_grafana'
73
81
ENV LOGPATH=$DEFAULTLOGPATH
74
- RUN echo "the log will use $LOGPATH"
75
82
76
83
ARG DEFAULTLOGLEVEL=15
77
84
ENV LOGLEVEL=$DEFAULTLOGLEVEL
78
85
79
- COPY ./requirements/requirements_ubi9.txt /root/requirements_ubi9.txt
80
- # COPY ./requirements/requirements_ubi.in /root/requirements_ubi.in
81
-
82
- RUN yum install -y python39 python3-pip
83
-
84
- # RUN /usr/bin/python3 -m pip install pip-tools && \
85
- # /usr/bin/python3 -m piptools compile /root/requirements_ubi.in --output-file /root/requirements_ubi9.txt && \
86
- # echo "Compiled python packages: $(cat /root/requirements_ubi9.txt)"
87
-
88
- RUN /usr/bin/python3 -m pip install -r /root/requirements_ubi9.txt && \
89
- echo "Installed python version: $(/usr/bin/python3 -V)" && \
90
- echo "Installed python packages: $(/usr/bin/python3 -m pip list)"
86
+ RUN echo "the HTTP/S protocol is set to $PROTOCOL" && \
87
+ echo "the HTTP/S basic authentication is set to $BASICAUTH" && \
88
+ echo "the OpentTSDB API HTTP/S port is set to $PORT" && \
89
+ echo "the Prometheus API HTTPS port is set to $PROMETHEUS" && \
90
+ echo "the PERFMONPORT port is set to $SERVERPORT" && \
91
+ echo "the pmcollector server ip is set to $SERVER" && \
92
+ echo "the log will use $LOGPATH"
93
+
94
+ RUN if [ $(expr "$BASE" : '.*python.*' ) -eq 0 ]; then \
95
+ yum install -y python39 python3-pip; \
96
+ if [ "$BUILD_ENV" = "build_test" ]; then \
97
+ python3 -m pip install pip-tools && \
98
+ python3 -m piptools compile /root/requirements_ubi.in --output-file /root/requirements_ubi9.txt && \
99
+ echo "Compiled python packages: $(cat /root/requirements_ubi9.txt)" ; fi && \
100
+ python3 -m pip install -r /root/requirements_ubi9.txt && \
101
+ echo "Installed python version: $(python3 -V)" && \
102
+ echo "Installed python packages: $(python3 -m pip list)" ; else \
103
+ echo "Already using python container as base image. No need to install it." && \
104
+ python3 -m pip install -r /root/requirements.in && \
105
+ echo "Installed python packages: $(python3 -m pip list)" ; fi
91
106
92
107
USER root
93
108
@@ -101,8 +116,8 @@ COPY ./source/gpfsConfig/mmsdrfs* /var/mmfs/gen/
101
116
COPY ./source/gpfsConfig/ZIMon* /opt/IBM/zimon/
102
117
103
118
RUN if [ "${APIKEYVALUE:0:1}" = "/" ]; then ln -s $APIKEYVALUE /etc/perfmon-api-keys; echo "APIKEYVALUE is a PATH" ; else echo "APIKEYVALUE not a PATH" ; fi && \
104
- if [ -z "$TLSKEYPATH" ] || [ -z "$TLSCERTFILE" ] || [ -z "$TLSKEYFILE" ] && [ "$PROTOCOL" = "https" ]; then echo "TLSKEYPATH FOR SSL CONNECTION NOT SET - ERROR" ; exit 1; else echo "PASS" ; fi
105
- RUN echo "the ssl certificates path is set to $TLSKEYPATH"
119
+ if [ -z "$TLSKEYPATH" ] || [ -z "$TLSCERTFILE" ] || [ -z "$TLSKEYFILE" ] && [ "$PROTOCOL" = "https" ]; then echo "TLSKEYPATH FOR SSL CONNECTION NOT SET - ERROR" ; exit 1; else echo "PASS" ; fi && \
120
+ echo "the ssl certificates path is set to $TLSKEYPATH"
106
121
107
122
# Switch to the working directory
108
123
WORKDIR /opt/IBM/bridge
0 commit comments