FROM python:latest

ENV TZ Europe/Zurich


RUN useradd --create-home --shell /bin/bash --uid 1001 autonews
# id mapped to local user
# home directory needed for pip package installation
RUN export PATH=/home/autonews/.local/bin:$PATH


RUN mkdir -p /app/auto_news
RUN chown -R autonews:autonews /app
USER autonews

COPY requirements.txt /app/requirements.txt
RUN python3 -m pip install -r /app/requirements.txt

COPY . /app/auto_news
WORKDIR /app/auto_news