ARG RADARR_VERSION=4.3.2.6857
#FROM golang:bullseye AS builder
#ARG SHOUTRRR_VERSION
#RUN git clone -b ${SHOUTRRR_VERSION} --depth 1 https://github.com/containrrr/shoutrrr.git ./shoutrrr
#RUN cd ./shoutrrr && \
#    mkdir /output && \
#    go build -o /output ./shoutrrr

FROM debian:10-slim
ARG RADARR_VERSION
WORKDIR /root
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# Install tools to add extra repos
RUN apt-get update && \
    apt-get -y --no-install-recommends install \
      bash \
      curl \ 
      jq \
      ca-certificates \
      gnupg \
      apt-transport-https \
      tar \
      dirmngr
# Mediainfo repo install
RUN curl -O https://mediaarea.net/repo/deb/repo-mediaarea_1.0-21_all.deb \
 && dpkg -i repo-mediaarea_1.0-21_all.deb \
 && apt-get update
# Install dependancies
RUN apt-get -y install \
      sqlite3 \
      mediainfo \
 && rm -rf /var/lib/apt/lists/*
# Create the user that will run the service
# RUN useradd -UM -u 1000 -d /app -s /bin/bash radarr  
# Download and extract the package
RUN mkdir -p /app/bin \
 && mkdir /config \
 && curl -fsSL "https://radarr.servarr.com/v1/update/master/updatefile?version=${RADARR_VERSION}&os=linux&runtime=netcore&arch=x64" | tar xzf - -C /app/bin --strip-components=1 \
 && rm -rf /app/bin/Radarr.Update \
 && echo -e "PackageVersion=${RADARR_VERSION}\nPackageAuthor=Michael\nUpdateMethod=Docker\nBranch=master" > "/app/package_info" \
 && chmod -R u=rwX,go=rX /app \
 && chown -R root /app \
 && chown -R root /config
# Set startup conditions
VOLUME /config
EXPOSE 7878
# USER radarr
WORKDIR /app
ENTRYPOINT ["/app/bin/Radarr"]
CMD ["--nobrowser", "--data=/config"]



