FROM python:3.7-buster

EXPOSE 5000/tcp

# Upgrade base packages and install dependencies.
RUN case $(uname -m) in \
    "armv6l") extra_packages="libatlas3-base libgfortran5" ;; \
    "armv7l") extra_packages="libatlas3-base libgfortran5" ;; \
  esac && \
  apt-get update && \
  apt-get upgrade -y && \
  apt-get install -y \
  libatomic1 \
  rng-tools \
  rtl-sdr \
  sox \
  tini \
  usbutils \
  ${extra_packages} && \
  rm -rf /var/lib/apt/lists/*

# Copy in requirements.txt.
COPY auto_rx/requirements.txt \
  /tmp/requirements.txt

# Install Python packages.
RUN pip3 --no-cache-dir install \
  --extra-index-url https://www.piwheels.org/simple \
  -r /tmp/requirements.txt

# Run bash.
WORKDIR /root
CMD ["/bin/bash"]
