FROM emby/embyserver:latest

MAINTAINER docker@custom-coding.net

ENTRYPOINT ["/init"]

COPY root/ /

RUN apt-get update -qq && apt-get install -qq -y \
    fuse \
    wget \
  && echo "user_allow_other" > /etc/fuse.conf \
  && /plexdrive-install.sh \
  && rm -rf /tmp/* /var/lib/apt/lists/*

HEALTHCHECK --interval=3m --timeout=100s \
CMD test -r $(find ${PLEXDRIVE_MOUNT_POINT} -maxdepth 1 -print -quit) && /healthcheck.sh || exit 1