-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile-controllers.test
54 lines (45 loc) · 1.99 KB
/
Dockerfile-controllers.test
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
# Copyright IBM Corporation 2024.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Description:
# This Dockerfile.test is for running the csi controller local tests inside a container.
# Its similar to the Dockerfile, but with additional requirements-tests.txt and ENTRYPOINT to run the local tests.
FROM registry.access.redhat.com/ubi8/python-39:1-206.1732638092 AS builder
USER root
RUN if [[ "$(uname -m)" != "x86"* ]]; then yum install -y rust-toolset; fi
USER default
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /tmp
COPY controllers/servers/csi/requirements.txt ./csi_requirements.txt
COPY controllers/servers/host_definer/requirements.txt ./host_definer_requirements.txt
# avoid default- boringssl lib, since it does not support z systems
ENV GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True
RUN pip3 install -r ./csi_requirements.txt -r ./host_definer_requirements.txt
USER root
COPY controllers/scripts/csi_general .
RUN ./csi_pb2.sh
RUN pip3 install .
# Requires to run local testing
COPY controllers/tests/requirements.txt ./requirements-tests.txt
RUN pip3 install -r ./requirements-tests.txt
FROM registry.access.redhat.com/ubi8/python-39:1-206.1732638092
COPY --from=builder /opt/app-root /opt/app-root
COPY ./common /driver/common
COPY ./controllers/ /driver/controllers/
USER root
RUN groupadd -g 9999 appuser && \
useradd -r -u 9999 -g appuser appuser
RUN chown -R appuser:appuser /driver /opt/app-root
USER appuser
WORKDIR /driver
ENV PYTHONPATH=/driver
ENTRYPOINT ["/driver/controllers/scripts/entrypoint-test.sh"]