1
- # ##############################################################################
2
- # Install OpenSearch Benchmark from PyPI to build a Docker image
3
- # ##############################################################################
1
+ # #######################################################
2
+ # Install OpenSearch Benchmark to build a Docker image #
3
+ # #######################################################
4
4
5
- FROM python:3.11.2-slim
6
- ARG VERSION=testing
5
+ ARG VERSION
6
+ ARG BUILD_ENV=production
7
7
8
- ENV BENCHMARK_RUNNING_IN_DOCKER=True
8
+ FROM python:3.11.2-slim as build_env_testing
9
+ ONBUILD COPY opensearch-benchmark-git/ ./
10
+
11
+ FROM python:3.11.2-slim as build_env_production
12
+ ONBUILD RUN echo Production Environment
9
13
14
+ FROM build_env_${BUILD_ENV}
10
15
WORKDIR /opensearch-benchmark
16
+ ENV BENCHMARK_RUNNING_IN_DOCKER=True
11
17
12
18
RUN apt-get -y update && \
13
19
apt-get install -y curl git gcc pbzip2 pigz && \
@@ -18,15 +24,8 @@ RUN groupadd --gid 1000 opensearch-benchmark && \
18
24
useradd -d /opensearch-benchmark -m -k /dev/null -g 1000 -N -u 1000 -l -s /bin/bash benchmark
19
25
20
26
ENV PIP_ONLY_BINARY=h5py
21
-
22
- # Copy file for test purpose and will remove during prod publishing
23
- COPY opensearch-benchmark-git/ ./opensearch-benchmark-git
24
-
25
- # Currently we always have the $VERSION arg substituted during prod publishing
26
- # Default VERSION=testing to enter test mode based on user inputs.
27
- RUN if [ "$VERSION" = "testing" ] ; then echo Testing; cp -a opensearch-benchmark-git/* ./; ls -l; python3 -m pip install -e . ; \
28
- else echo Production; rm -rf opensearch-benchmark-git; ls -l; python3 -m pip install opensearch-benchmark==$VERSION ; fi
29
-
27
+ RUN if [ "$BUILD_ENV" = "testing" ] ; then echo Testing; ls -l; python3 -m pip install -e . ; \
28
+ else echo Production; if [ -z "$VERSION" ] ; then python3 -m pip install opensearch-benchmark ; else python3 -m pip install opensearch-benchmark==$VERSION ; fi; fi
30
29
31
30
RUN mkdir -p /opensearch-benchmark/.benchmark && \
32
31
chown -R 1000:0 /opensearch-benchmark/.benchmark
0 commit comments