FROM ubuntu:eoan

RUN apt-get update 

RUN apt-get install -y wget

# Upgrade Node
RUN wget -qO- https://deb.nodesource.com/setup_10.x | bash -
RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
  nodejs \
  gcc \
  g++ \
  make \
  cmake

# You can then install the latest npm and npx
RUN npm install --global npm@latest

# Speed up face-recognition and dev tools
RUN apt-get install -y libopenblas-dev

# Required for dlib to build
RUN apt-get install -y libx11-dev libpng16-16

# NEF processing uses darktable-cli, provided via darktable
RUN apt-get install -y darktable

# Create a user with sudo access
RUN DEBIAN_FRONTEND=noninteractive \
  && apt-get install --no-install-recommends -y \
    sudo
  
# NOTE: Requires 'sudo' package to already be installed
RUN groupadd -g 1000 user \
  && useradd --no-log-init \
    -s /bin/bash \
    -u 1000 \
    -m \
    -g user \
    -G sudo \
    -p $(echo "user" | openssl passwd -stdin) user
  
# Set 'sudo' to NOPASSWD for all container users
RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers

RUN DEBIAN_FRONTEND=noninteractive \
  && apt-get update \
  && apt-get install --no-install-recommends -y \
    git \
    sqlite3

COPY . /website

#USER user
WORKDIR /website
RUN npm install

CMD [ "/website/entrypoint.sh" ]
