Skip to content

Instantly share code, notes, and snippets.

@hyzhak
Created July 20, 2018 00:02
Show Gist options
  • Save hyzhak/bccdeeee7514548d199a14988b762b54 to your computer and use it in GitHub Desktop.
Save hyzhak/bccdeeee7514548d199a14988b762b54 to your computer and use it in GitHub Desktop.
FoundationDB and Python3 together in the one Docker container
FROM foundationdb:ubuntu-18.04
# for the moment it is not published
# current version in preview here:
# https://github.com/apple/foundationdb/pull/355
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.5
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
python3-distutils \
wget \
&& rm -rf /var/lib/apt/lists/*
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -s idle3 idle \
&& ln -s pydoc3 pydoc \
&& rm /usr/bin/python \
&& ln -s python3.6 /usr/bin/python \
&& ln -s python3-config python-config
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 10.0.1
RUN set -ex; \
\
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
\
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
"pip==$PYTHON_PIP_VERSION" \
; \
pip --version; \
\
find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' +; \
rm -f get-pip.py
ENV PYTHONPATH /code
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
CMD ["python3"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment