# -- usage --
# docker run -it \
#   -v $(pwd):/onboardme \
#   onboardme \
#   /usr/bin/python3 -m build --wheel . && \
#   twine check dist/*

FROM debian:bookworm-slim as Base

ENV DEBIAN_FRONTEND=noninteractive
ENV HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
ENV HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar"
ENV HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew"
ENV MANPATH="$MANPATH:/home/linuxbrew/.linuxbrew/share/man"
ENV INFOPATH="$INFOPATH:/home/linuxbrew/.linuxbrew/share/info"
ENV PATH="$PATH:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin"
ENV NONINTERACTIVE=1
ENV PATH="$PATH:/home/onboardme/.local/bin"

WORKDIR /onboardme

# install apt packages and create user
RUN apt-get update && \
  apt-get upgrade -y && \
  apt-get install -y \
  python3-pip \
  python3-dev \
  python3-venv \
  build-essential \
  wget \
  curl \
  git \
  sudo \
  vim && \
  apt-get install -y twine

RUN useradd -ms /usr/sbin/nologin friend && \
    usermod -aG sudo friend && \
    echo 'friend ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER friend
WORKDIR /home/friend

RUN wget https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh && \
  chmod +x install.sh && \
  chmod 777 install.sh && \
  /bin/bash install.sh && git config --global init.defaultBranch main && \
  sudo apt-get install build-essential