# FROM python:3.9-slim-bookworm
ARG BUILD_FROM
FROM $BUILD_FROM

# Install cron
# RUN apt-get update && apt-get -y install cron
# Install python3 and cron (dcron)
RUN apk add --no-cache \
    python3 \
    py3-pip \
    dcron

WORKDIR /app

RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"
RUN source /app/venv/bin/activate

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# Upewnij się, że skrypt entrypoint.sh jest wykonywalny
RUN chmod a+x /app/entrypoint.sh

# Uruchom skrypt entrypoint, który zajmie się resztą
CMD ["/app/entrypoint.sh"]
