Skip to content

Instantly share code, notes, and snippets.

@coltenkrauter
Last active September 29, 2020 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coltenkrauter/da76779334d4d04c947555da22bd3487 to your computer and use it in GitHub Desktop.
Save coltenkrauter/da76779334d4d04c947555da22bd3487 to your computer and use it in GitHub Desktop.
Resolve issues where docker pip install fails due to a cryptography dependency.
# https://github.com/odoo/odoo/issues/8849#issuecomment-322115976
# 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