Skip to content

Instantly share code, notes, and snippets.

@davidsm
Created Mar 21, 2017
Embed
What would you like to do?
mysql-python
FROM alpine:latest
ENV MYSQL_CONNECTOR_VERSION 2.1.3
ENV MYSQL_CONNECTOR_ARCHIVE mysql-connector-python-${MYSQL_CONNECTOR_VERSION}.tar.gz
ENV MYSQL_KEYID 5072E1F5
COPY ${MYSQL_CONNECTOR_ARCHIVE}.asc ${MYSQL_CONNECTOR_ARCHIVE}.asc
RUN apk add --no-cache --virtual .deps curl mysql-dev gnupg file gcc python-dev musl-dev g++ && \
apk add --no-cache python && \
gpg --recv-keys ${MYSQL_KEYID} && \
curl -fSsL http://dev.mysql.com/get/Downloads/Connector-Python/${MYSQL_CONNECTOR_ARCHIVE} -o ${MYSQL_CONNECTOR_ARCHIVE} && \
gpg --verify ${MYSQL_CONNECTOR_ARCHIVE}.asc ${MYSQL_CONNECTOR_ARCIVE} && \
tar xfz ${MYSQL_CONNECTOR_ARCHIVE} && \
cd ${MYSQL_CONNECTOR_ARCHIVE%.tar.gz} && \
python setup.py install --with-mysql-capi=$(which mysql_config) && \
cd - && \
rm -rf ${MYSQL_CONNECTOR_ARCHIVE%.tar.gz} ${MYSQL_CONNECTOR_ARCHIVE} && \
apk del .deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment