FROM scratch AS handout
COPY app /handout/app
COPY Dockerfile /handout
COPY docker-compose.yml /handout


FROM python:3.13-trixie AS challenge

RUN apt-get update && apt-get install -y \
    dnsmasq \
    dnsutils \
    && rm -rf /var/lib/apt/lists/*


WORKDIR /app
COPY ./app/requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt


COPY app/dnsmasq.conf /etc/dnsmasq.conf
COPY app /app

ARG FLAG=GPNCTF{HERE_IS_A_NICE_EXAMPLE_FLAG_FROM_THE_DOCKERFILE}
RUN echo "${FLAG}" > /flag

RUN chmod 755 /app/entrypoint.sh
ENTRYPOINT [ "/app/entrypoint.sh" ]

EXPOSE 80
