How to install pillow, psycopg, pylibmc packages in python:alpine image

Here is the examples how to install some packages in python:alpine image. Some dependencies should be installed permanently and some only for package build and removed after.

pillow

RUN apk add --no-cache jpeg-dev zlib-dev

psycopg

RUN apk add --no-cache postgresql-dev

pylibmc

RUN apk add --no-cache libmemcached-dev zlib-dev 

Then to install:


RUN apk add --no-cache --virtual .build-deps build-base linux-headers \
    
    && pip3 install pip --upgrade \
    
    && pip3 install <packages list> \
    
    && apk del .build-deps
comments powered by Disqus