content: FROM amazonlinux:2.0.20190508
  ENV VERSION 1
  # install dependencies.
  RUN yum update -y && \
      yum install -y which git sudo procps-ng util-linux autoconf automake \
      libtool make bzip2 bzip2-devel openssl-devel gmp-devel libstdc++ libcurl-devel \
      libusbx-devel python3 python3-devel python-devel libedit-devel doxygen \
      graphviz clang patch llvm-devel llvm-static vim-common jq && \
      yum clean all && rm -rf /var/cache/yum
  RUN curl -LO https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2.tar.gz && \
      tar -xzf cmake-3.16.2.tar.gz && \
      cd cmake-3.16.2 && \
      ./bootstrap --prefix=/usr/local && \
      make -j$(nproc) && \
      make install && \
      rm -rf cmake-3.16.2.tar.gz cmake-3.16.2
  # build boost
  RUN curl -LO https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2 && \
      tar -xjf boost_1_71_0.tar.bz2 && \
      cd boost_1_71_0 && \
      ./bootstrap.sh --prefix=/usr/local && \
      ./b2 --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -q -j$(nproc) install && \
      cd / && \
      rm -rf boost_1_71_0.tar.bz2 /boost_1_71_0
  #install libpq
  RUN amazon-linux-extras enable postgresql11 && \
      yum install -y libpq-devel postgresql-server && \
      yum clean all && rm -rf /var/cache/yum
  #build libpqxx
  RUN curl -L https://github.com/jtv/libpqxx/archive/7.2.1.tar.gz | tar zxvf - && \
      cd  libpqxx-7.2.1  && \
      cmake -DSKIP_BUILD_TEST=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/libpq -DCMAKE_BUILD_TYPE=Release -S . -B build && \
      cmake --build build && cmake --install build && \
      cd .. && rm -rf libpqxx-7.2.1
  ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig
  # install nvm
  RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
  # load nvm in non-interactive shells
  RUN echo 'export NVM_DIR="$HOME/.nvm"' > ~/.bashrc && \
      echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bashrc
  # install node 10
  RUN bash -c '. ~/.bashrc; nvm install --lts=dubnium' && \
      ln -s "/root/.nvm/versions/node/$(ls -p /root/.nvm/versions/node | sort -Vr | head -1)bin/node" /usr/local/bin/node && \
      ln -s "/root/.nvm/versions/node/$(ls -p /root/.nvm/versions/node | sort -Vr | head -1)bin/npm" /usr/local/bin/npm
  # setup Postgress
  RUN su - postgres -c "/usr/bin/initdb" 