# 1. A: Define a base image
# FROM scratch
# FROM busybox
# FROM alpine:3.22.1
# FROM alpine:latest
# FROM python:3.12
# FROM debian:bookworm-slim
FROM nginx:1.29

ARG USERNAME=itdominator
ARG UID=1000
ARG GID=1000

# 1. B: Set ENV Variables
ENV TERM=xterm-256color

# 2. Setup home user
RUN groupadd -g ${GID} ${USERNAME}
RUN useradd -u ${UID} -g ${GID} -s /bin/bash -m ${USERNAME}
COPY env/* /home/${USERNAME}/
RUN /bin/bash -c 'mkdir -p /home/${USERNAME}/{Coding,Downloads,LazyShare,.local,.config,.cache,.thumbnails}'
RUN chown ${USERNAME}:${USERNAME} -R /home/${USERNAME}

# 3. A: Install dependencies
RUN apt-get update && apt-get install -y \
    --no-install-recommends \
    --no-install-suggests \
    pkg-config \
    ca-certificates \
    libreadline-dev \
    liblzma-dev \
    libsqlite3-dev \
    libncurses5-dev \
    libncursesw5-dev \
    libgirepository1.0-dev \
    libssl-dev libcairo2-dev \
    libgdk-pixbuf-xlib-2.0-0 \
    python3-gi gir1.2-gtk-3.0 \
    gir1.2-gdkpixbuf-2.0 \
    bash-completion \
    parallel \
    bat \
    7zip \
    zip \
    unzip \
    tar \
    curl \
    wget \
    fzf \
    less \
    tree \
    ripgrep \
    htop \
    nano \
    git \
    ranger

# 4. Copy files over

# 5. Cleanup
RUN apt-get autoremove -yqq --purge \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/* \
  && rm -rf /tmp/*

# 6. Expose Port and define the command used to run the app
EXPOSE 80
EXPOSE 443
CMD ["bash"]
