FROM registry.access.redhat.com/ubi8/go-toolset:latest as builder
# get yq
RUN go get github.com/mikefarah/yq

# FROM cypress/included:6.2.1 as production
FROM quay.io/kcormier/cypress-included:latest as production

USER root

COPY --from=builder /opt/app-root/src/go/bin/yq /usr/bin/yq

WORKDIR /usr/src/app

# copy dependencies needed for Cypress tests
COPY package.json .
COPY cypress.json .
COPY download-clis.sh .
COPY cypress ./cypress
COPY start-cypress-tests.sh .

RUN npm install 

RUN sh download-clis.sh

RUN ["chmod", "+x", "./start-cypress-tests.sh"]

ENTRYPOINT ["./start-cypress-tests.sh"]
