FROM alpine:3.23

RUN apk add --no-cache python3 py3-pip

# Copy requirements and install Python packages
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install --break-system-packages -r /tmp/requirements.txt

# Clean up apk cache
RUN rm -rf /var/cache/apk/*

WORKDIR /app
COPY app.py /app/app.py
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENV LISTEN_ADDRESS=0.0.0.0
ENV LISTEN_PORT=8080

EXPOSE 8080

ENTRYPOINT [ "/entrypoint.sh" ]
