Last active
July 21, 2018 17:25
-
-
Save johnnyopao/3a9656b76eac6036e72f36ac7a61ff7a to your computer and use it in GitHub Desktop.
Example for Medium post: https://medium.com/@johnnyopao/python-dependencies-and-aws-lambda-18acbdebca20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM amazonlinux:latest | |
WORKDIR /app | |
# install pip | |
RUN curl -s https://bootstrap.pypa.io/get-pip.py | python | |
# requirements for compiling JAGs | |
RUN yum install -y \ | |
gcc \ | |
gcc-gfortran \ | |
lapack-devel \ | |
gcc-c++ \ | |
findutils \ | |
python27-devel | |
COPY JAGS-4.3.0.tar.gz . | |
RUN tar xf JAGS-4.3.0.tar.gz | |
# compile JAGs | |
WORKDIR JAGS-4.3.0/ | |
RUN F77=gfortran ./configure --libdir=/usr/local/lib64 | |
RUN make | |
RUN make install | |
# install python deps | |
WORKDIR /app | |
ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig/:$PKG_CONFIG_PATH | |
COPY requirements.txt . | |
# numpy needs to be installed globally first as pyjags | |
# checks the regular path for numpy as a requirement | |
RUN pip install numpy | |
RUN pip install -t ./lib -r requirements.txt | |
# Copy libraries into project lib directory | |
RUN cp -a /usr/local/lib64/JAGS lib | |
RUN cp /usr/local/lib64/libjags.so.4 lib | |
RUN cp /usr/local/lib64/libjrmath.so.0 lib | |
RUN cp /usr/lib64/libgfortran.so.3 lib | |
RUN cp /usr/lib64/libblas.so.3 lib | |
RUN cp /usr/lib64/liblapack.so.3 lib | |
RUN cp /usr/lib64/libquadmath.so.0 lib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment