FROM php:8.4-apache
# 设置为非交互模式，避免安装过程中需要手动确认
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get upgrade -y
RUN DEBIAN_FRONTEND=noninteractive

COPY ./go2php.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924
COPY ./catflag /
COPY ./start.sh /
COPY ./flag.txt /flag.txt
COPY ./index.php /var/www/html
COPY ./monitor.sh /home/ctf/
COPY ./php.ini /usr/local/etc/php

# 设置权限

RUN useradd -m ctf
WORKDIR /home/ctf
RUN chmod 777 /start.sh
RUN chmod 400 /flag.txt
RUN chmod 4755 /catflag
RUN chmod -R 777 /var/www/html 
RUN chmod 777 /home/ctf/ 
RUN chmod +x /home/ctf/monitor.sh
RUN chmod +x /start.sh

CMD ["/start.sh"]