Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
feat(docker): add alpine image with minimum dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 12, 2019
1 parent 8aef9e6 commit da1bbc0
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions Dockerfiles/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -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 /

Expand Down

0 comments on commit da1bbc0

Please sign in to comment.