# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
        git \
        nano \
        tmux \
        openssh-server \
        && apt-get clean && rm -rf /var/lib/apt/lists/*

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt

COPY ./ssh-template /etc/sshd_config.d/ansiblessh.conf

# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN groupadd -g 1000 appuser &&  useradd --no-log-init --shell /bin/bash -u 1000 -g 1000 -o -c "" -m appuser

USER appuser

WORKDIR /home/appuser

RUN echo 'export PATH="$PATH:/home/appuser/.local/bin"' >> /home/appuser/.bashrc
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["/bin/bash"]
