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

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

# Pull base image
FROM debian:unstable
MAINTAINER igor.chorazewicz@intel.com

# Set required environment variables
ENV OS debian
ENV OS_VER unstable
ENV PACKAGE_MANAGER deb
ENV NOTTY 1

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

# Update the Apt cache and install basic tools
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
	autoconf \
	automake \
	build-essential \
	clang \
	clang-format-9 \
	cmake \
	curl \
	debhelper \
	devscripts \
	doxygen \
	fakeroot \
	git \
	gdb \
	graphviz \
	gzip \
	libc6-dbg \
	libdaxctl-dev \
	libndctl-dev \
	libmemkind-dev \
	libnode-dev \
	libnuma-dev \
	libtbb-dev \
	libtext-diff-perl \
	libtool \
	libunwind8-dev \
	numactl \
	pandoc \
	pkg-config \
	rapidjson-dev \
	sudo \
	wget \
	whois \
 && rm -rf /var/lib/apt/lists/*

# 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 dpkg

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

# Add user
ENV USER user
ENV USERPASS pass
RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS`
USER $USER
