Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Resolve issues where docker pip install fails due to a cryptography dependency.
# For APT
apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
# For APK
apk add python3-dev libffi-dev libressl-dev openldap-dev
# Example alpine docker file
FROM python:3.7-alpine
# Update packages
RUN apk update
# Install python3 libs and pip3
RUN apk add python3-dev libffi-dev libressl-dev openldap-dev
# Install a C/C++ compiler
RUN apk add gcc g++
# Install timezone
RUN apk add --no-cache tzdata
ENV TZ America/Los_Angeles
# Add bash
RUN apk add --no-cache bash
# Upgrade pip and setuptools
RUN pip3 install --upgrade pip \
&& pip3 install --upgrade setuptools
# Install certificates store
RUN apk add ca-certificates \
&& rm -rf /var/cache/apk/*
# Install app dependencies
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment