# Copyright (c) 2020 Red Hat, Inc.
FROM node:erbium

ENV NODE_ENV=development

USER root

RUN mkdir -p /opt/app-root/src/grc-ui

WORKDIR /opt/app-root/src/grc-ui

COPY nightwatch.conf.js nightwatch.json package.json ./
COPY config ./config
COPY tests ./tests
COPY build ./build

RUN apt-get update && apt-get install -y apache2-utils


# Install Chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install

RUN sh ./build/download-clis.sh

RUN npm install \
    chromedriver \
    nightwatch \
    nightwatch-coverage \
    nconf@0.10.0 \
    log4js@6.3.0 \
    del@5.1.0 \ 
    js-yaml@3.14.0 \
    @slack/web-api@5.11.0

CMD ["./build/run-docker-tests.sh"]
