FROM python:3.8-alpine

LABEL maintainer quentinduchemin@tuta.io
ARG METRICS_BOT_VERSION=v1.1

# Get release
RUN wget -O code.tar.gz https://gitlab.utc.fr/picasoft/projets/picasoft-metrics-bot/-/archive/${METRICS_BOT_VERSION}/picasoft-metrics-bot-${METRICS_BOT_VERSION}.tar.gz \
    && tar xvf code.tar.gz \
    && mv picasoft-metrics-bot-${METRICS_BOT_VERSION} /code \
    && rm code.tar.gz

# Custom Picasoft entrypoint
COPY entrypoint.sh /code/entrypoint.sh
RUN chmod +x /code/entrypoint.sh

WORKDIR /code

# Install dependencies
RUN pip3 install -r requirements.txt

ENTRYPOINT [ "/code/entrypoint.sh" ]