Skip to content

Commit

Permalink
Merge pull request #20 from ecmwf/feature/faster-docker
Browse files Browse the repository at this point in the history
uv is added for the worker polytope-server
  • Loading branch information
jameshawkes authored Sep 18, 2024
2 parents 1d82366 + 603ce3d commit 80049c4
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,18 @@ ARG developer_mode
# contains compilers for building wheels which we don't want in the final image
RUN apt update
RUN apt-get install -y --no-install-recommends gcc libc6-dev make gnupg2

COPY ./requirements.txt /requirements.txt
RUN python -m pip install -r requirements.txt --user
RUN python -m pip install geopandas==1.0.1 --user
RUN pip install uv --user
ENV PATH="/root/.venv/bin:/root/.local/bin:${PATH}"
RUN uv venv /root/.venv
RUN uv pip install -r requirements.txt
RUN uv pip install geopandas==1.0.1

COPY . ./polytope
RUN set -eux \
&& if [ $developer_mode = true ]; then \
python -m pip install ./polytope/polytope-mars ./polytope/polytope ./polytope/covjsonkit --user; \
uv pip install ./polytope/polytope-mars ./polytope/polytope ./polytope/covjsonkit; \
fi

#######################################################
Expand All @@ -316,8 +320,8 @@ RUN set -eux \
&& adduser --system polytope --ingroup polytope --home /home/polytope \
&& mkdir /polytope && chmod -R o+rw /polytope

RUN apt update
RUN apt install -y curl nano sudo ssh libgomp1 vim
RUN apt update \
&& apt install -y curl nano sudo ssh libgomp1 vim

# Add polytope user to passwordless sudo group during build
RUN usermod -aG sudo polytope
Expand All @@ -335,8 +339,9 @@ COPY --chown=polytope --from=mars-cpp-base-final /opt/ecmwf/mars-client-cpp /
COPY --chown=polytope --from=mars-cpp-base-final /root/.local /home/polytope/.local
COPY --chown=polytope --from=mars-c-base-final /opt/ecmwf/mars-client /opt/ecmwf/mars-client
COPY --chown=polytope --from=mars-c-base-final /usr/local/bin/mars /usr/local/bin/mars
RUN sudo apt update
RUN sudo apt install -y libgomp1 git libnetcdf19 liblapack3 libfftw3-bin libproj25
RUN sudo apt update \
&& sudo apt install -y libgomp1 git libnetcdf19 liblapack3 libfftw3-bin libproj25 \
&& sudo rm -rf /var/lib/apt/lists/*


# all of this is needed by the C client, would be nice to remove it at some point
Expand Down Expand Up @@ -372,7 +377,7 @@ COPY --chown=polytope --from=gribjump-base-final /root/.local /home/polytope/.lo
# COPY polytope-deployment/common/default_fdb_schema /polytope/config/fdb/default

# Copy python requirements
COPY --chown=polytope --from=worker-base /root/.local /home/polytope/.local
COPY --chown=polytope --from=worker-base /root/.venv /home/polytope/.local


# Install the server source
Expand Down

0 comments on commit 80049c4

Please sign in to comment.