Skip to content

Commit

Permalink
Add server dockerfile (#2602)
Browse files Browse the repository at this point in the history
Co-authored-by: Taner Topal <[email protected]>
  • Loading branch information
danielnugraha and tanertopal authored Nov 16, 2023
1 parent ea8ac9e commit 7ae14a2
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2023 Flower Labs GmbH. All Rights Reserved.

FROM ubuntu:22.04 as base

ENV DEBIAN_FRONTEND noninteractive

# Install system dependencies
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
clang-format git unzip ca-certificates openssh-client liblzma-dev \
build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev wget\
libsqlite3-dev curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev \
libxmlsec1-dev libffi-dev liblzma-dev \
&& rm -rf /var/lib/apt/lists/*

# Install PyEnv and Python
ARG PYTHON_VERSION
ENV PYENV_ROOT /root/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
RUN pyenv install ${PYTHON_VERSION} \
&& pyenv global ${PYTHON_VERSION} \
&& pyenv rehash

# Install specific version of pip
ARG PIP_VERSION
RUN python -m pip install pip==$PIP_VERSION

# Install specific version of setuptools
ARG SETUPTOOLS_VERSION
RUN python -m pip install setuptools==$SETUPTOOLS_VERSION

# Install poetry as all examples use it and therefore it should be available for custom images
ARG POETRY_VERSION
RUN curl -sSL https://install.python-poetry.org | python3 - --version ${POETRY_VERSION}
ENV PATH /root/.local/bin:$PATH
RUN poetry config virtualenvs.create false

# Server image
FROM base as server

WORKDIR /app
ARG FLWR_VERSION
RUN python -m pip install -U flwr[rest]==${FLWR_VERSION}
ENTRYPOINT ["python", "-c", "from flwr.server import run_server\nrun_server()"]

# Test if Flower can be successfully installed and imported
FROM server as test
RUN python -c "from flwr.server import run_server"

0 comments on commit 7ae14a2

Please sign in to comment.