Skip to content

Commit

Permalink
Add rockylinux8 build related image for building rpm (#2122)
Browse files Browse the repository at this point in the history
* Add rockylinux8 build related image for building rpm

Signed-off-by: Peter Zhu <[email protected]>

* Change images tags

Signed-off-by: Peter Zhu <[email protected]>

* Switch yum to dnf for el8 and enable powertools

Signed-off-by: Peter Zhu <[email protected]>

* Switch yum to dnf for el8 and enable powertools

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored May 14, 2022
1 parent 62a6bda commit 4fc0805
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# 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 both developers and ci/cd tools in OpenSearch / OpenSearch-Dashboards
# Please read the README.md file for all the information before using this dockerfile


FROM rockylinux:8

ARG MAVEN_DIR=/usr/local/apache-maven

# Ensure localedef running correct with root permission
USER 0

# Setup ENV to prevent ASCII data issues with Python3
RUN echo "export LC_ALL=en_US.utf-8" >> /etc/profile.d/python3_ascii.sh && \
echo "export LANG=en_US.utf-8" >> /etc/profile.d/python3_ascii.sh && \
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || echo set locale

# Add normal dependencies
RUN dnf clean all && \
dnf update -y && \
dnf install -y which curl git gnupg2 tar net-tools procps-ng python3 python3-devel python3-pip zip unzip

# 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 Python37 dependencies
RUN dnf install -y @development zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel findutils

# Add Dashboards dependencies
RUN dnf install -y xorg-x11-server-Xvfb gtk2-devel gtk3-devel libnotify-devel GConf2 nss libXScrnSaver alsa-lib

# Add Notebook dependencies
RUN dnf install -y nss xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc fontconfig freetype && dnf clean all

# Add Yarn dependencies
RUN dnf groupinstall -y "Development Tools" && dnf clean all && rm -rf /var/cache/dnf/*

#JDK setup
COPY --chown=0:0 config/jdk-setup.sh /tmp
RUN /tmp/jdk-setup.sh

# Install higher version of maven 3.8.x
RUN export MAVEN_URL=`curl -s https://maven.apache.org/download.cgi | grep -Eo '["\047].*.bin.tar.gz["\047]' | tr -d '"'` && \
mkdir -p $MAVEN_DIR && (curl -s $MAVEN_URL | tar xzf - --strip-components=1 -C $MAVEN_DIR) && \
echo "export M2_HOME=$MAVEN_DIR" > /etc/profile.d/maven_path.sh && \
echo "export M2=\$M2_HOME/bin" >> /etc/profile.d/maven_path.sh && \
echo "export PATH=\$M2:\$PATH" >> /etc/profile.d/maven_path.sh && \
ln -sfn $MAVEN_DIR/bin/mvn /usr/local/bin/mvn

# Setup Shared Memory
RUN chmod -R 777 /dev/shm

# Install PKG builder dependencies with rvm
RUN curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - && \
curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - && \
curl -sSL https://get.rvm.io | bash -s stable

# Switch shell for rvm related commands
SHELL ["/bin/bash", "-lc"]
CMD ["/bin/bash", "-l"]

# Install ruby / rpm / fpm related dependencies
RUN . /etc/profile.d/rvm.sh && rvm install 2.4.0 && rvm --default use 2.4.0 && dnf install -y rpm-build createrepo && dnf clean all

ENV RUBY_HOME=/usr/local/rvm/rubies/ruby-2.4.0/bin
ENV RVM_HOME=/usr/local/rvm/bin
ENV GEM_HOME=/usr/share/opensearch/.gem
ENV GEM_PATH=$GEM_HOME
ENV PATH=$RUBY_HOME:$RVM_HOME:$PATH

# Install Python37 binary
RUN curl https://www.python.org/ftp/python/3.7.7/Python-3.7.7.tgz | tar xzvf - && \
cd Python-3.7.7 && \
./configure --enable-optimizations && \
make altinstall

# Setup Python37 links
RUN ln -sfn /usr/local/bin/python3.7 /usr/bin/python3 && \
ln -sfn /usr/local/bin/pip3.7 /usr/bin/pip && \
ln -sfn /usr/local/bin/pip3.7 /usr/local/bin/pip && \
ln -sfn /usr/local/bin/pip3.7 /usr/bin/pip3 && \
pip3 install pipenv && pipenv --version

# Add k-NN Library dependencies
# EL8 requires install config-manager and enable powertools to consume openblas-static
RUN dnf install epel-release -y && dnf repolist && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --set-enabled powertools && \
dnf install openblas-static lapack gcc-gfortran -y && dnf clean all
RUN pip3 install pip==21.3.1
RUN pip3 install cmake==3.21.3
RUN pip3 install awscli==1.22.12

# Change User
USER 1000
WORKDIR /usr/share/opensearch

# Install fpm for opensearch dashboards core
RUN gem install fpm -v 1.14.2
ENV PATH=/usr/share/opensearch/.gem/gems/fpm-1.14.2/bin:$PATH
RUN fpm -v
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pipeline {
environment {
AGENT_X64 = 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host'
AGENT_ARM64 = 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host'
IMAGE_RPM = 'opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2' // required for rpm to create digest sha256 correctly with rpm 4.12+
IMAGE_RPM = 'opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-build-v2' // required for rpm to create digest sha256 correctly with rpm 4.12+
}
parameters {
string(
Expand Down
2 changes: 1 addition & 1 deletion jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pipeline {
environment {
AGENT_X64 = 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host'
AGENT_ARM64 = 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host'
IMAGE_RPM = 'opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2' // required for rpm to create digest sha256 correctly with rpm 4.12+
IMAGE_RPM = 'opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-build-v2' // required for rpm to create digest sha256 correctly with rpm 4.12+
}
parameters {
string(
Expand Down

0 comments on commit 4fc0805

Please sign in to comment.