Created
April 15, 2016 12:37
-
-
Save ncopa/d7c2e816fb09066022ba4e723621bef8 to your computer and use it in GitHub Desktop.
This file contains 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 python:2.7-alpine | |
MAINTAINER Nick Janetakis <[email protected]> | |
ENV INSTALL_PATH /bsawf | |
RUN mkdir -p $INSTALL_PATH | |
WORKDIR $INSTALL_PATH | |
COPY requirements.txt requirements.txt | |
RUN apk add --no-cache --virtual .build-deps \ | |
build-base postgresql-dev libffi-dev \ | |
&& pip install -r requirements.txt \ | |
&& find /usr/local \ | |
\( -type d -a -name test -o -name tests \) \ | |
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ | |
-exec rm -rf '{}' + \ | |
&& runDeps="$( \ | |
scanelf --needed --nobanner --recursive /usr/local \ | |
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | |
| sort -u \ | |
| xargs -r apk info --installed \ | |
| sort -u \ | |
)" \ | |
&& apk add --virtual .rundeps $runDeps \ | |
&& apk del .build-deps | |
COPY . . | |
CMD gunicorn -b 0.0.0.0:8000 --access-logfile - "bsawf.app:create()" |
With this example, what if a binary exists in /usr/bin and not /usr/local? Won't it's dependencies get wiped out?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. Your gist has been incorporated (and credited) into http://nickjanetakis.com/blog/alpine-based-docker-images-make-a-difference-in-real-world-apps.