Skip to content
Snippets Groups Projects
Commit 47ac6b5f authored by lcappelli's avatar lcappelli
Browse files

Replace storm2 image with copy-and-paste

parent 70994a69
No related branches found
No related tags found
1 merge request!19Resolve "Remove dependency from storm2/build project"
Pipeline #72309 failed
FROM baltig.infn.it:4567/storm2/build/ngx-voms-build:issue-17-latest ### FROM baltig.infn.it:4567/storm2/build/ngx-voms-build:issue-17-latest
## FROM baltig.infn.it:4567/storm2/build/base
FROM centos:7
# Allow customization of build user ID and name
ARG BUILD_USER=build
ARG BUILD_USER_UID=1000
# Allow customization of storm user ID and name
ARG STORM_USER=storm
ARG STORM_USER_UID=1001
# Allow customization of test user ID and name
ARG TEST_USER=test
ARG TEST_USER_UID=1002
ENV BUILD_USER $BUILD_USER
ENV BUILD_USER_UID $BUILD_USER_UID
ENV STORM_USER $STORM_USER
ENV STORM_USER_UID $STORM_USER_UID
ENV TEST_USER $TEST_USER
ENV TEST_USER_UID $TEST_USER_UID
RUN echo "include_only=.garr.it,.cern.ch" >> /etc/yum/pluginconf.d/fastestmirror.conf && \
yum clean all && \
yum install -y hostname epel-release && \
yum -y update && \
yum -y install which wget tar sudo file && \
echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
adduser --uid ${BUILD_USER_UID} ${BUILD_USER} && \
usermod -a -G wheel ${BUILD_USER} && \
adduser --uid ${STORM_USER_UID} ${STORM_USER} && \
usermod -a -G wheel ${STORM_USER} && \
adduser --uid ${TEST_USER_UID} ${TEST_USER} && \
usermod -a -G wheel ${TEST_USER} && \
yum clean all && \
rm -rf /var/cache/yum
ADD assets/setup.sh /docker/
ADD assets/user-setup.sh /docker/
ADD assets/build-install-openresty.sh /docker/
ADD --chown=$BUILD_USER:$BUILD_USER assets/nginx-httpg_no_delegation.patch /home/$BUILD_USER/
ADD --chown=$BUILD_USER:$BUILD_USER assets/build-install-ngx-voms.sh /home/$BUILD_USER/bin/
RUN sh /docker/setup.sh
USER $BUILD_USER
RUN sh /docker/build-install-openresty.sh \
&& sh /docker/user-setup.sh
USER root USER root
......
#!/bin/sh
# Copyright 2018 Istituto Nazionale di Fisica Nucleare
#
# Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the
# European Commission - subsequent versions of the EUPL (the "Licence"). You may
# not use this work except in compliance with the Licence. You may obtain a copy
# of the Licence at:
#
# https://joinup.ec.europa.eu/software/page/eupl
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# Licence for the specific language governing permissions and limitations under
# the Licence.
# This script builds in debug mode and installs openresty together with the
# ngx_http_voms_module.
#
# The script requires the locations of the openresty bundle and of the
# ngx_http_voms_module code (for example as checked-out from git). The locations
# are expressed by the environment variables OPENRESTY_ROOT and
# NGX_HTTP_VOMS_MODULE_ROOT respectively, if available. If they are not set,
# they are guessed:
# * a unique openresty bundle is looked for in ${HOME}
# * the ngx_http_voms_module code is looked for in the working directory of the
# continuous integration environment first and then in ${HOME}
#
# The script works best (i.e. it is tested) if run within a docker container
# started from the storm2/ngx-voms-build image.
usage()
{
echo "USAGE: $0 [OPTIONS] [TEXT]"
echo ""
echo "The default optimization level is -O3"
echo ""
echo "OPTIONS"
echo ""
echo "-h|--help"
echo "-o|--opt-log to enable the --with-debug option and the optimization level -O2"
echo "-d|--debug to enable the --with-debug option and the optimization level -O0"
echo "-c|--coverage to add the --coverage option to the --with-{ld|cc}-opt option and enable the debug options"
echo ""
}
#The script at the moment allows only debug builds, i.e. "-O0". This option is kept in shell variables cc2, but there is no way to set it to something else. I propose that by default it is set to -O2 (or even -O3) and is set to -O0 only if the option --debug is passed to the script. Moreover --coverage should imply --debug.
cc1=-g
debug=""
cc3=""
cc2=-O2
ld=""
while [ "$1" != "" ]; do
option=`echo $1 | awk -F= '{print $1}'`
case $option in
-o|--opt-log)
debug='--with-debug'
cc2=-O2
echo Enabled the debug option $debug and the optimization level $cc2
;;
-d|--debug)
debug='--with-debug'
cc2=-O0
echo Enabled the debug option $debug and the optimization level $cc2
;;
-c|--coverage)
cc3=--coverage
ld='--with-ld-opt=--coverage'
echo Enabled the coverage options $cc3 $ld
;;
-h|--help)
usage
exit
;;
*)
debug=""
cc3=""
cc2=-O2
ld=""
;;
esac
shift
done
if [ ! -z "${cc3}" ]; then
if [ -z "${debug}" ]; then
debug="--with-debug"
cc2=-O0
echo Enabled the debug option $debug and the optimization level $cc2
fi
fi
if [ -f "${HOME}/openresty-env" ]; then
. ${HOME}/openresty-env
fi
gcc --version
openresty_root=${OPENRESTY_ROOT:-$(ls -d ${HOME}/openresty-*/ 2> /dev/null)}
if [ $(echo ${openresty_root} | wc -w) != 1 -o ! -d "${openresty_root}" ]; then
>&2 echo 'Invalid openresty environment ("'${openresty_root}'")'
exit 1
fi
module_root=${NGX_HTTP_VOMS_MODULE_ROOT:-${CI_PROJECT_DIR:-${HOME}/ngx_http_voms_module}}
if [ ! -d "${module_root}" ]; then
>&2 echo 'Invalid ngx_http_voms_module environment ("'${module_root}'")'
exit 1
fi
RESTY_PACKAGES_PREFIX=/usr/local/openresty
ZLIB_PREFIX=/usr
OPENSSL_PREFIX=/usr
PCRE_PREFIX=/usr
cd ${openresty_root}
./configure \
--with-cc="ccache gcc -fdiagnostics-color=always" \
--with-cc-opt="-DNGX_LUA_ABORT_AT_PANIC -I${ZLIB_PREFIX}/include -I${PCRE_PREFIX}/include -I${OPENSSL_PREFIX}/include" \
--with-ld-opt="-L${ZLIB_PREFIX}/lib -L${PCRE_PREFIX}/lib -L${OPENSSL_PREFIX}/lib -Wl,-rpath,${ZLIB_PREFIX}/lib:${PCRE_PREFIX}/lib:${OPENSSL_PREFIX}/lib" \
--with-luajit-xcflags="-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT" \
${RESTY_CONFIG_OPTIONS} \
${debug} \
--with-cc-opt="${cc1} ${cc2} ${cc3}" \
${ld} \
--add-module=${module_root}
nginx_version=$(find build -name nginx.h | xargs awk '/define NGINX_VERSION/ {print $3}' | tr -d '"')
cd build/nginx-${nginx_version}
patch -p1 < ${HOME}/nginx-httpg_no_delegation.patch
cd -
make -j $(nproc)
make install
#!/bin/sh
set -ex
# adapted from https://github.com/openresty/docker-openresty
# configuring, building and installing is not strictly necessary, since
# module development requires to rebuild nginx itself, but it's a good
# check to see if everything is ok
# configuring has the benefit that it builds and installs luajit, which
# can then be reused during development (see the additions to .bashrc)
# Docker Build Arguments
RESTY_VERSION=${RESTY_VERSION:-"1.19.9.1"}
RESTY_PREFIX=${HOME}/local/openresty
RESTY_CONFIG_OPTIONS="\
--with-compat \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--without-http_rds_csv_module \
--without-http_rds_json_module \
--without-lua_rds_parser \
--without-mail_imap_module \
--without-mail_pop3_module \
--without-mail_smtp_module \
--with-pcre-jit \
--with-stream \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-threads \
--prefix=${RESTY_PREFIX} \
"
cd
wget --quiet https://openresty.org/download/openresty-${RESTY_VERSION}.tar.gz
tar zxf openresty-${RESTY_VERSION}.tar.gz
cd openresty-${RESTY_VERSION}
./configure \
--with-cc="ccache gcc -fdiagnostics-color=always" \
--with-cc-opt="-DNGX_LUA_ABORT_AT_PANIC" \
--with-luajit-xcflags="-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT" \
${RESTY_CONFIG_OPTIONS}
make
make install
# add the location of openresty executables to the PATH
# save resty configuration options for future reuse during development
cat << EOF > ${HOME}/openresty-env
PATH="${RESTY_PREFIX}/luajit/bin:${RESTY_PREFIX}/nginx/sbin:${RESTY_PREFIX}/bin:\${PATH}"
export RESTY_CONFIG_OPTIONS="${RESTY_CONFIG_OPTIONS} --with-luajit=${RESTY_PREFIX}/luajit"
EOF
#!/bin/sh
set -ex
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
yum -y install \
gcc-c++ \
GeoIP-devel \
gd-devel \
gettext \
ccache \
libxslt-devel \
lcov \
perl-ExtUtils-Embed \
perl-Test-Nginx \
perl-Digest-SHA \
readline-devel \
boost-devel \
voms-devel \
make \
patch \
less
#!/bin/sh
set -ex
cat << EOF >> ${HOME}/.bashrc
if [ -f "\${HOME}/openresty-env" ]; then
. \${HOME}/openresty-env
fi
if [ -d \${HOME}/bin ]; then
PATH=\${HOME}/bin:\${PATH}
fi
if [ -n "\${PS1}" ]; then
echo
echo "To build and install openresty with the ngx_http_voms_module run 'build-install-ngx-voms.sh'"
echo
fi
EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment