Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Python 3.10 from deadsnakes PPA #937

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 60 additions & 10 deletions openfl-docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,80 @@

# If your machine is behind a proxy, make sure you set it up in ~/.docker/config.json

FROM ubuntu:22.04
ARG IMAGE_NAME=ubuntu
ARG IMAGE_TAG=22.04

# Base image to be used everywhere
FROM ${IMAGE_NAME}:${IMAGE_TAG} as base
RUN apt-get clean && \
apt-get update && \
apt-get upgrade -y && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

# Python image
FROM base as python-dev

ARG PYTHON=python3.10
ARG PIP=pip3.10

RUN apt-get update && \
apt-get install --no-install-recommends --fix-missing -y \
curl \
gpg-agent \
software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends --fix-missing -y \
${PYTHON} \
${PYTHON}-distutils && \
curl -s https://bootstrap.pypa.io/get-pip.py | ${PYTHON} && \
apt-get purge -y \
curl \
gpg-agent \
software-properties-common && \
apt-get autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

RUN ln -sf /usr/bin/${PYTHON} /usr/bin/python && \
ln -sf /usr/bin/${PYTHON} /usr/bin/python3 && \
ln -sf /usr/local/bin/${PIP} /usr/local/bin/pip && \
ln -sf /usr/local/bin/${PIP} /usr/local/bin/pip3

FROM base as python-base

ARG PYTHON=python3.10

COPY --from=python-dev /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
COPY --from=python-dev /usr/lib/${PYTHON} /usr/lib/${PYTHON}
COPY --from=python-dev /usr/local/lib/${PYTHON} /usr/local/lib/${PYTHON}
COPY --from=python-dev /usr/bin /usr/bin
COPY --from=python-dev /usr/local/bin /usr/local/bin

FROM python-base as openfl

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG INSTALL_SOURCES="yes"

WORKDIR /zlib
#zlib install to 1.2.13
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing wget build-essential
RUN apt-get update && \
apt-get install -y --no-install-recommends --fix-missing wget build-essential
RUN wget --no-check-certificate https://github.com/madler/zlib/archive/refs/tags/v1.2.13.tar.gz && tar -xvf ./v1.2.13.tar.gz && cd zlib-1.2.13 && ./configure --prefix=/usr && make && make install
RUN rm -rf zlib-1.2.13 && rm -rf v1.2.13.tar.gz
RUN apt-get remove --purge -y wget build-essential && \
apt-get autoclean -y && \
apt-get auto-remove -y

WORKDIR /thirdparty

RUN dpkg --get-selections | grep -v deinstall | awk '{print $1}' > base_packages.txt && \
rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
apt-get install -y --no-install-recommends --fix-missing \
openssh-server=\* \
python3.10=\* \
python3-distutils=\* \
curl=\* \
ca-certificates=\* && \
if [ "$INSTALL_SOURCES" = "yes" ]; then \
Expand All @@ -52,10 +102,10 @@ RUN apt-get update && \
WORKDIR /openfl
COPY . .

# Install pip
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py && rm -rf get-pip.py
RUN pip install --no-cache-dir .
# Install OpenFL
RUN pip install --no-cache-dir install --upgrade pip setuptools
RUN pip install --no-cache-dir .

WORKDIR /thirdparty
RUN if [ "$INSTALL_SOURCES" = "yes" ]; then \
pip install --no-cache-dir pip-licenses; \
Expand Down
Loading