-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
79 lines (61 loc) · 2.48 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# docker build . -t 'sympy_antlr'
# docker run -it --rm sympy_antlr:latest /bin/bash
# docker run -it --rm -v `pwd`:/scratch sympy_antlr:latest /bin/bash
# docker run -it --rm -v `pwd`:/scratch sympy_antlr:latest python3 generate_latex_files.py
# as of 20200520, the build process takes 20 minutes on BHP's mac
# https://github.com/phusion/baseimage-docker
# https://hub.docker.com/r/phusion/baseimage/tags
FROM phusion/baseimage:0.11
RUN apt-get update && \
apt-get install -y \
# text editing
vim \
# python 3
python3 \
python3-pip \
python3-dev \
# distributed version control
git \
# download files from the internet
wget \
# latex
texlive \
# file compression
zip \
#Java Runtime for Antlr4
default-jre \
&& rm -rf /var/lib/apt/lists/*
RUN echo "alias python=python3" > /root/.bashrc
#RUN python3 setup.py install
WORKDIR /usr/local/lib
# msg says this is is needed to build the ANTLR grammar
RUN curl -O https://www.antlr.org/download/antlr-4.7.1-complete.jar
WORKDIR /opt/
# download the sympy source to /opt/
RUN git clone https://github.com/sympy/sympy.git
# BHP -- this probably isn't necessary since ANTLR is built from source?
WORKDIR /opt/
RUN pip3 install antlr4-python3-runtime==4.7.1 mpmath
#debugger
RUN pip3 install pudb
# layer the local ANTLR modifications on top of the sympy source in /opt/
COPY sympy/parsing/latex/_antlr/LaTeX.g4 /opt/sympy/sympy/parsing/latex
COPY sympy/parsing/latex/_antlr/rename.py /opt/sympy/sympy/parsing/latex
COPY scripts/_parse_latex_antlr.py /opt/sympy/sympy/parsing/latex
COPY sympy/parsing/tests /opt/sympy/sympy/parsing/
WORKDIR /opt/sympy/sympy/parsing/latex
ENV CLASSPATH=".:/usr/local/lib/antlr-4.7.1-complete.jar:$CLASSPATH"
RUN java -jar /usr/local/lib/antlr-4.7.1-complete.jar LaTeX.g4 -no-visitor -no-listener -o _antlr
RUN python3 rename.py
WORKDIR /opt/sympy
RUN python3 setup.py install
WORKDIR /opt/
# msg uses ipython for the REPL inside the container
RUN pip3 install ipython
RUN wget https://raw.githubusercontent.com/allofphysicsgraph/proofofconcept/gh-pages/v7_pickle_web_interface/flask/data.json
# the purpose of grabbing AMSmath is because bhp thinks the symbols to be parsed exist in the source
# https://ctan.org/pkg/amsmath?lang=en
RUN wget http://mirrors.ctan.org/macros/latex/required/amsmath.zip
#RUN mv amsmath.zip /opt/
RUN unzip /opt/amsmath.zip
COPY scripts/generate_latex_files.py /opt/