anchor.diff:  USER plex
   
   WORKDIR /usr/lib/plexmediaserver
  -ENTRYPOINT ["/entrypoint.sh"]
  +ENTRYPOINT ["/usr/local/bin/dumb-init", "/entrypoint.sh"]
   CMD ["/usr/lib/plexmediaserver/Plex Media Server"]
  
positive.code: FROM debian:jessie
  
  # This gets the latest non-plexpass version
  # Note: We created a dummy /bin/start to avoid install to fail due to upstart not being installed.
  # We won't use upstart anyway.
  RUN set -x \
      # Create plex user
   && useradd --system --uid 797 -M --shell /usr/sbin/nologin plex \
      # Download and install Plex (non plexpass) after displaying downloaded URL in the log.
   && apt-get update \
   && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
          ca-certificates \
          curl \
          xmlstarlet \
   && curl -I 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' \
   && curl -L 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' -o plexmediaserver.deb \
   && touch /bin/start \
  
negative.code:  && dpkg -i plexmediaserver.deb \
   && rm -f plexmediaserver.deb \
   && rm -f /bin/start \
      # Install dumb-init
      # https://github.com/Yelp/dumb-init
   && DUMP_INIT_URI=$(curl -L https://github.com/Yelp/dumb-init/releases/latest | grep -Po '(?<=href=")[^"]+_amd64(?=")') \
   && curl -Lo /usr/local/bin/dumb-init "https://github.com/$DUMP_INIT_URI" \
   && chmod +x /usr/local/bin/dumb-init \
      # Create writable config directory in case the volume isn't mounted
   && mkdir /config \
   && chown plex:plex /config
  