# Parameters related to building rocFFT
ARG base_image

FROM ${base_image}
LABEL maintainer="rocprim-maintainer@amd.com"

ARG user_uid

# Install dependent packages
# Dependencies:
# * hcc-config.cmake: pkg-config
# * tensile: python2.7, python-yaml
# * rocfft-test: gfortran, googletest
# * rocfft-bench: libboost-program-options-dev
# * libhsakmt.so: libnuma1
RUN zypper refresh && zypper -n install\
    sudo \
    ca-certificates \
    git \
    gcc-c++ \
    gcc-fortran \
    make \
    cmake \
    fftw3-devel \
    rpm-build \
    dpkg \
    python2-PyYAML \
    libboost_program_options1_66_0-devel\
    libcxxtools9 \
    libnuma1 

# docker pipeline runs containers with particular uid
# create a jenkins user with this specific uid so it can use sudo priviledges
# Grant any member of sudo group password-less sudo privileges
RUN useradd --create-home -u ${user_uid} -o -G video --shell /bin/bash jenkins && \
    echo '%video ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/sudo-nopasswd && \
    chmod 400 /etc/sudoers.d/sudo-nopasswd
