FROM debian:stretch

RUN apt-get -qq update \
  && apt-get install -y curl gnupg2 apt-transport-https \
  && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
  && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
  && curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
  && echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
  && curl -sL https://deb.nodesource.com/setup_10.x | bash - \
  && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y --no-install-recommends \
  git ca-certificates nodejs yarn  \
  hicolor-icon-theme g++ google-chrome-stable \
  && npm install -g yarn \
  && update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10 \
  && yarn config set cache-folder /var/cache/npm \
  && rm -rf /var/lib/apt/lists/*

ENV DAPPER_RUN_ARGS --privileged -v npm-cache:/var/cache/npm
ENV DAPPER_ENV REPO TAG DRONE_TAG IMAGE_NAME BUILD_LATEST
ENV DAPPER_SOURCE /tmp/ui
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
WORKDIR ${DAPPER_SOURCE}

RUN mkdir dist

ENTRYPOINT ["./scripts/entry.sh"]
CMD ["ci"]
