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

Fix/update dockerimages #3155

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
45 changes: 30 additions & 15 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,50 @@ FROM ubuntu:22.04
# https://code.visualstudio.com/docs/remote/containers-advanced#_creating-a-nonroot-user
ARG USERNAME=flwr-vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG USER_GID=${USER_UID}
ENV PATH="/home/$USERNAME/.local/bin:${PATH}"

# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
RUN groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo bash \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
&& apt-get install --no-install-recommends -y \
sudo=1.9.9-1ubuntu2.4 \
bash=5.1-6ubuntu1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}

# A persistent volume will be configured in devcontainer.json so we don't loose the commandhistory
# after rebuilding the container
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE='/commandhistory/.bash_history'" \
&& mkdir /commandhistory \
&& touch /commandhistory/.bash_history \
&& chown -R $USERNAME /commandhistory \
&& echo $SNIPPET >> "/home/$USERNAME/.bashrc"
&& chown -R ${USERNAME} /commandhistory \
&& echo ${SNIPPET} >> "/home/${USERNAME}/.bashrc"

# Install system dependencies
RUN apt-get update
RUN apt-get install -y curl wget gnupg python3 python-is-python3 python3-pip git \
build-essential tmux vim
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
python3=3.10.6-1~22.04 \
python-is-python3=3.9.2-2 \
python3-pip=22.0.2+dfsg-1ubuntu0.4 \
git=1:2.34.1-1ubuntu1.10 \
curl=7.81.0-1ubuntu1.15 \
wget=1.21.2-2ubuntu1 \
gnupg=2.2.27-3ubuntu2.1 \
build-essential=12.9ubuntu3 \
tmux=3.2a-4ubuntu0.2 \
vim=2:8.2.3995-1ubuntu2.15 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN python -m pip install \
RUN pip install --no-cache-dir \
pip==23.3.1 \
setuptools==68.2.2 \
poetry==1.7.1

USER $USERNAME
ENV PATH="/home/$USERNAME/.local/bin:${PATH}"
USER ${USERNAME}
13 changes: 6 additions & 7 deletions examples/embedded-devices/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ ARG BASE_IMAGE
# Pull the base image from NVIDIA
FROM $BASE_IMAGE

# Update pip
RUN pip3 install --upgrade pip

# Install flower
RUN pip3 install flwr>=1.0
RUN pip3 install flwr-datsets>=0.2
RUN pip3 install tqdm==4.65.0
# Update pip && Install flower
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir \
flwr>=1.0 \
flwr-datsets>=0.2 \
tqdm==4.65.0

WORKDIR /client
16 changes: 8 additions & 8 deletions examples/flower-via-docker-compose/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim-buster
FROM python:3.10-slim-bookworm

# Set the working directory in the container to /app
WORKDIR /app
Expand All @@ -8,12 +8,12 @@ WORKDIR /app
COPY ./requirements.txt /app/requirements.txt

# Install gcc and other dependencies
RUN apt-get update && apt-get install -y \
gcc \
python3-dev && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
gcc=4:8.3.0-1 \
python3-dev=3.7.3-1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt


RUN pip install --no-cache-dir -r requirements.txt
4 changes: 2 additions & 2 deletions examples/flower-via-docker-compose/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
flwr==1.7.0
tensorflow==2.13.1
numpy==1.24.3
prometheus_client == 0.19.0
flwr_datasets[vision] == 0.0.2
prometheus_client==0.19.0
flwr_datasets[vision]==0.0.2
24 changes: 14 additions & 10 deletions examples/quickstart-mlcube/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
FROM ubuntu:22.04
LABEL author="The Flower Authors"

RUN apt-get update && \
# install Python
apt-get install -y python3 python3-distutils curl && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
curl -sSL -O https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py && \
rm get-pip.py && \
# clean apt cache
rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
python3=3.10.6-1~22.04 \
python3-pip=22.0.2+dfsg-1ubuntu0.4 \
python3-distutils=3.10.8-1~22.04 \
curl=7.81.0-1ubuntu1.15 \
build-essential=12.9ubuntu3 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt /requirements.txt
RUN pip3 install --no-cache-dir -r /requirements.txt

# fixes pyyaml installation issues
RUN pip install --no-cache-dir --no-build-isolation \
pyyaml==5.4.1 \
&& pip install --no-cache-dir -r /requirements.txt

COPY mnist.py /workspace/mnist.py
ENTRYPOINT ["python3", "/workspace/mnist.py"]
2 changes: 1 addition & 1 deletion examples/quickstart-mlcube/dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PyYAML==5.4
Cython==0.29.37
tensorflow==2.14.0
tensorflow-estimator==2.14.0
requests[security]