anchor.diff:  #
   ##############################
   FROM alpine:3.9.2
  +ENV WORKDIR /mnt
   
  -ENV WORKDIR /m4b-tool
  -ARG M4B_TOOL_DOWNLOAD_LINK="https://github.com/sandreas/m4b-tool/releases/latest/download/m4b-tool.phar"
   
   RUN echo "---- INSTALL RUNTIME PACKAGES ----" && \
     apk add --no-cache --update --upgrade \
  
positive.code:     && wget https://github.com/nu774/fdkaac/archive/1.0.0.tar.gz \
      && tar xzf 1.0.0.tar.gz \
      && cd fdkaac-1.0.0 \
      && autoreconf -i && ./configure && make -j4 && make install && rm -rf /tmp/* \
  && echo "---- REMOVE BUILD DEPENDENCIES (to keep image small) ----" \
      && apk del --purge build-dependencies && rm -rf /tmp/*
  
  
negative.code: 
  
  # copy ffmpeg static with libfdk from mwader docker image
  COPY --from=mwader/static-ffmpeg:4.2.2 /ffmpeg /usr/local/bin/
  
  # copy compiled mp4v2 binaries, libs and fdkaac encoder to runtime image
  COPY --from=builder /usr/local/bin/mp4* /usr/local/bin/fdkaac /usr/local/bin/
  COPY --from=builder /usr/local/lib/libmp4v2* /usr/local/lib/
  
  
  ARG M4B_TOOL_DOWNLOAD_LINK="https://github.com/sandreas/m4b-tool/releases/latest/download/m4b-tool.tar.gz"
  
  # workaround to copy a local m4b-tool.phar IF it exists
  ADD ./Dockerfile ./dist/m4b-tool.phar* /tmp/
  RUN echo "---- INSTALL M4B-TOOL ----" \
      && if [ ! -f /tmp/m4b-tool.phar ]; then \
              cd /tmp/ && \
              wget "${M4B_TOOL_DOWNLOAD_LINK}" && \
              if [ ! -f /tmp/m4b-tool.phar ]; then \
                  tar xzf m4b-tool*.tar.gz && rm m4b-tool*.tar.gz ;\
              fi && \
              cd - ; \
         fi \
      && mv /tmp/m4b-tool.phar /usr/local/bin/m4b-tool \
      && chmod +x /usr/local/bin/m4b-tool
  
  WORKDIR ${WORKDIR}
  CMD ["list"]
  ENTRYPOINT ["m4b-tool"]
  
  