Skip to content
Permalink
Browse files

feat(docker): add alpine image with minimum dependencies

  • Loading branch information...
hanxiao committed Aug 12, 2019
1 parent 8aef9e6 commit da1bbc0da54ae1b0ab98e6b645280c968b738c6a
Showing with 7 additions and 15 deletions.
  1. +7 −15 Dockerfiles/alpine.Dockerfile
@@ -1,30 +1,22 @@
FROM python:3.7.4-alpine AS dependency
FROM python:3.7.4-alpine AS base

WORKDIR /gnes/

COPY setup.py ./setup.py
ADD . ./

RUN apk add --no-cache \
--virtual=.build-dependencies \
build-base g++ gfortran file binutils zeromq-dev libzmq \
build-base g++ gfortran file binutils zeromq-dev \
musl-dev python3-dev py-pgen cython openblas-dev && \
apk add libstdc++ openblas && \
apk add --no-cache libstdc++ openblas libzmq && \
ln -s locale.h /usr/include/xlocale.h && \
python -c "import distutils.core;s=distutils.core.run_setup('setup.py').install_requires;f=open('requirements_tmp.txt', 'w');[f.write(v+'\n') for v in s];f.close()" && \
cat requirements_tmp.txt && \
pip install --no-cache-dir --compile -r requirements_tmp.txt && \
pip install . --no-cache-dir --compile && \
find /usr/lib/python3.7/ -name 'tests' -exec rm -r '{}' + && \
find /usr/lib/python3.7/site-packages/ -name '*.so' -print -exec sh -c 'file "{}" | grep -q "not stripped" && strip -s "{}"' \; && \
rm /usr/include/xlocale.h && \
apk del .build-dependencies

FROM dependency as base

ADD . ./

RUN pip install . --no-cache-dir --compile && \
rm -rf /tmp/* && \
rm -rf /gnes
rm -rf /gnes && \
apk del .build-dependencies

WORKDIR /

0 comments on commit da1bbc0

Please sign in to comment.
You can’t perform that action at this time.