#FROM cypress/browsers:node14.16.0-chrome89-ff86 // cypress test cases are failing in gitlab hence disabling node 14
FROM cypress/browsers:node-16.18.1-chrome-110.0.5481.96-1-ff-109.0-edge-110.0.1587.41-1


RUN apt-get update && apt-get install -y \
    make \
    g++ \
    python3 \
    p7zip-full \
    gnupg

ARG node_env
ARG server_protocol
ARG server_host
ARG server_port
ARG client_protocol
ARG client_host
ARG client_port
ARG use_colab_email
ARG flax_site_url

ENV NODE_ENV "development"
ENV SERVER_PROTOCOL "http"
ENV SERVER_HOST "0.0.0.0"
ENV SERVER_PORT "3000"
ENV CLIENT_PROTOCOL "http"
ENV CLIENT_HOST "0.0.0.0"
ENV CLIENT_PORT "4000"
ENV HOME "/home/node/app"
ENV USE_COLAB_EMAIL $use_colab_email
ENV FLAX_SITE_URL $flax_site_url


RUN mkdir -p ${HOME}
WORKDIR ${HOME}

# Only copy things needed for the yarn install
COPY package.json yarn.lock ./

# We do a development install because react-styleguidist is a dev dependency and we want to run tests
RUN [ "yarn", "install", "--frozen-lockfile" ]

ENV NODE_ENV ${NODE_ENV}

# Disabling the build for now, as it runs in the test server again
# RUN [ "npx", "pubsweet", "build"]

# The copy everything else that changes frequently
COPY . .
EXPOSE ${PORT}

CMD []

