tpotce/docker/tanner/phpox/Dockerfile

52 lines
1.3 KiB
Text
Raw Normal View History

2018-05-26 23:09:31 +00:00
FROM alpine
2019-08-16 14:43:10 +00:00
#
2018-05-26 23:09:31 +00:00
# Include dist
ADD dist/ /root/dist/
2019-08-16 14:43:10 +00:00
#
2018-05-26 23:09:31 +00:00
# Install packages
RUN apk -U --no-cache add \
build-base \
file \
git \
make \
php7 \
php7-dev \
python3 \
python3-dev \
re2c && \
pip3 install --no-cache-dir --upgrade pip && \
2019-08-16 14:43:10 +00:00
#
2018-05-26 23:09:31 +00:00
# Install bfr sandbox from git
2018-05-28 16:36:02 +00:00
git clone --depth=1 https://github.com/mushorg/BFR /opt/BFR && \
2018-05-26 23:09:31 +00:00
cd /opt/BFR && \
phpize7 && \
./configure \
--with-php-config=/usr/bin/php-config7 \
--enable-bfr && \
make && \
make install && \
cd / && \
rm -rf /opt/BFR /tmp/* /var/tmp/* && \
echo "zend_extension = "$(find /usr -name bfr.so) >> /etc/php7/php.ini && \
2019-08-16 14:43:10 +00:00
#
2018-05-26 23:09:31 +00:00
# Install PHP Sandbox
2018-05-28 16:36:02 +00:00
git clone --depth=1 https://github.com/mushorg/phpox /opt/phpox && \
2018-05-26 23:09:31 +00:00
cd /opt/phpox && \
cp /root/dist/sandbox.py . && \
pip3 install -r requirements.txt && \
make && \
2019-08-16 14:43:10 +00:00
#
2018-05-26 23:09:31 +00:00
# Clean up
apk del --purge build-base \
git \
php7-dev \
python3-dev && \
rm -rf /root/* && \
rm -rf /var/cache/apk/*
2019-08-16 14:43:10 +00:00
#
2018-05-26 23:09:31 +00:00
# Set workdir and start phpsandbox
2018-09-11 12:19:26 +00:00
STOPSIGNAL SIGKILL
2018-05-28 16:36:02 +00:00
USER nobody:nobody
2018-05-26 23:09:31 +00:00
WORKDIR /opt/phpox
2019-08-16 16:55:36 +00:00
CMD ["python3", "sandbox.py"]