FROM centos:8

SHELL ["/bin/bash", "-c"]

# Add the EPEL repolist
RUN dnf install --assumeyes epel-release && \
    dnf upgrade --assumeyes --refresh && \
    dnf install --assumeyes \
      bash \
      ca-certificates \
      curl \
      device-mapper-persistent-data \
      dnf-utils \
      gcc \
      gcc-c++ \
      git \
      htop \
      lvm2 \
      make \
      man \
      python3 \
      sudo \
      unzip \
      vim \
      wget && \
    dnf clean all

RUN dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo && \
    dnf install --assumeyes docker-ce && \
    systemctl enable docker

# Add docker-compose
RUN curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
RUN chmod +x /usr/local/bin/docker-compose

# Add a user `coder` so that you're not developing as the `root` user
RUN useradd coder \
      --create-home \
      --shell=/bin/bash \
      --groups=docker \
      --uid=1000 \
      --user-group && \
    echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd

USER coder

# install Homebrew, must be as a non-root user
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
ENV PATH /home/linuxbrew/.linuxbrew/bin:${PATH}
