# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2021, Intel Corporation

#
# Dockerfile - a 'recipe' for Docker to build an image of Fedora-based
#              environment prepared for running pmemkv build and tests.
#

# Pull base image
FROM fedora:32
MAINTAINER igor.chorazewicz@intel.com

# Set required environment variables
ENV OS fedora
ENV OS_VER 32
ENV PACKAGE_MANAGER rpm
ENV NOTTY 1

# Additional parameters to build docker without building components
ARG SKIP_VALGRIND_BUILD
ARG SKIP_PMDK_BUILD
ARG SKIP_LIBPMEMOBJCPP_BUILD

ARG LIBPMEMOBJ_CPP_DEPS="\
	libatomic"

# Install basic tools
RUN dnf update -y \
 && dnf install -y \
	autoconf \
	automake \
	clang \
	cmake \
	daxctl-devel \
	doxygen \
	gcc \
	gcc-c++ \
	gdb \
	git \
	graphviz \
	gzip \
	hub \
	libtool \
	libunwind-devel \
	make \
	man \
	memkind-devel \
	ndctl-devel \
	numactl-devel \
	pandoc \
	passwd \
	perl-Text-Diff \
	rapidjson-devel \
	rpm-build \
	sudo \
	tbb-devel \
	wget \
	which \
	$LIBPMEMOBJ_CPP_DEPS \
&& dnf clean all

# Install glibc-debuginfo
RUN dnf debuginfo-install -y glibc

# Install valgrind
COPY install-valgrind.sh install-valgrind.sh
RUN ./install-valgrind.sh

# Install pmdk
COPY install-pmdk.sh install-pmdk.sh
RUN ./install-pmdk.sh rpm

# Install pmdk c++ bindings
COPY install-libpmemobj-cpp.sh install-libpmemobj-cpp.sh
RUN ./install-libpmemobj-cpp.sh rpm

# Add user
ENV USER user
ENV USERPASS pass
RUN useradd -m $USER
RUN echo "$USER:$USERPASS" | chpasswd
RUN gpasswd wheel -a $USER
USER $USER
