From 75219a6f0e9e128e4dcb049a4ed43c884a640946 Mon Sep 17 00:00:00 2001 From: matthew-752 <68411354+matthew-752@users.noreply.github.com> Date: Fri, 17 Jul 2020 15:42:55 +1200 Subject: [PATCH] Create Dockerfile to run phc and php2py Compiling PHC on modern version of Ubuntu / etc is difficult, so I made a Dockerfile that will build PHC on Ubuntu 14.04 and run php2py on an input file. --- Dockerfile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..74b0a08 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,46 @@ +# Build PHP 5.x compiler and Python translater container + +# put your code in code/in.php +# run docker below and read the output in code/out.py +# +# docker build . -t php2py +# docker run \ +# --rm \ +# --user $(id -u):$(id -g) \ +# -v `pwd`/code/:/code \ +# php2py + + +FROM ubuntu:14.04 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get install -y \ + build-essential \ + libgc-dev \ + libboost1.55-all-dev \ + graphviz \ + autoconf \ + git \ + php5-cli + +WORKDIR /opt + +RUN git clone https://github.com/taichino/php2py +RUN git clone https://github.com/pbiggar/phc + +WORKDIR /opt/phc + +RUN touch src/generated/* Makefile.in configure Makefile libltdl/aclocal.m4 libltdl/Makefile.in libltdl/configure libltdl/Makefile + +RUN ./configure +RUN make -j4 +RUN make install +RUN ldconfig + +WORKDIR /opt/php2py + +CMD phc --dump-xml=ast /code/in.php > /code/out.xml && \ + /opt/php2py/php2py.php /code/out.xml > /code/out.py