content: # Copyright OpenSearch Contributors
  # SPDX-License-Identifier: Apache-2.0
  #
  # The OpenSearch Contributors require contributions made to
  # this file be licensed under the Apache-2.0 license or a
  # compatible open source license.
  
  # This is a docker image specifically for standardize the ci/cd environment
  # for triggering and monitoring performance tests on Jenkins
  
  
  FROM centos:7
  
  # Ensure localedef running correct with root permission
  USER 0
  
  # Add normal dependencies
  RUN yum clean all && yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo && \
      yum install epel-release -y && \
      yum update -y && \
      yum install -y which curl git gnupg2 tar net-tools procps-ng python3 python3-devel python3-pip zip unzip jq gh
  
  # Create user group
  RUN groupadd -g 1000 opensearch && \
      useradd -u 1000 -g 1000 -d /usr/share/opensearch opensearch && \
      mkdir -p /usr/share/opensearch && \
      chown -R 1000:1000 /usr/share/opensearch
  
  # Add Python dependencies
  RUN yum install -y @development zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel findutils && \
      yum clean all
  
  # Install Python binary
  RUN curl https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz | tar xzvf - && \
      cd Python-3.9.7 && \
      ./configure --enable-optimizations && \
      make altinstall
  
  # Setup Python links
  RUN ln -sfn /usr/local/bin/python3.9 /usr/bin/python3 && \
      ln -sfn /usr/local/bin/pip3.9 /usr/bin/pip && \
      ln -sfn /usr/local/bin/pip3.9 /usr/local/bin/pip && \
      ln -sfn /usr/local/bin/pip3.9 /usr/bin/pip3 && \
      pip3 install pip==23.1.2 && pip3 install pipenv==2023.6.12 awscli==1.22.12
  
  # Add performance dependencies
  RUN pip3 install dataclasses_json~=0.5 aws_requests_auth~=0.4 json2html~=1.3.0 aws-cdk.core~=1.143.0 aws_cdk.aws_ec2~=1.143.0 \
                   aws_cdk.aws_iam~=1.143.0 boto3~=1.18 setuptools~=57.4 retry~=0.9
  
  # install yq
  COPY --chown=0:0 config/yq-setup.sh /tmp/
  RUN /tmp/yq-setup.sh
  
  # Change User
  USER 1000
  WORKDIR /usr/share/opensearch
  
  # Hard code node version and yarn version for now
  # nvm environment variables
  ENV NVM_DIR /usr/share/opensearch/.nvm
  ENV NODE_VERSION 16.20.0
  ARG NODE_VERSION_LIST="16.14.2 16.20.0"
  # install nvm
  # https://github.com/creationix/nvm#install-script
  RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
  # install node and npm
  COPY --chown=1000:1000 config/yarn-version.sh /tmp
  RUN source $NVM_DIR/nvm.sh && \
      for node_version in $NODE_VERSION_LIST; do nvm install $node_version; npm install -g yarn@`/tmp/yarn-version.sh main`; done
  # add node and npm to path so the commands are available
  ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
  ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
  # We use the version test to check if packages installed correctly
  # And get added to the PATH
  # This will fail the docker build if any of the packages not exist
  RUN node -v && npm -v && yarn -v
  RUN npm install -g fs-extra chalk@4.1.2 @aws-cdk/cloudformation-diff aws-cdk cdk-assume-role-credential-plugin@1.4.0
  
  