Skip to content

Commit

Permalink
fix(containers): Install eccodes in icon container, use py3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed May 23, 2024
1 parent 05168f2 commit cef3110
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions containers/icon/Containerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Build a virtualenv using the appropriate Debian release
# * Install python3-venv for the built-in Python3 venv module (not installed by default)
# * Install gcc libpython3-dev to compile C Python modules
# * In the virtualenv: Update pip setuputils and wheel to support building new packages
FROM debian:11-slim AS build
RUN apt-get update && \
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev && \
python3 -m venv /venv && \
/venv/bin/pip install --upgrade pip setuptools wheel
# Build a virtualenv using miniconda
# * Install required compilation tools for wheels via apt
# * Install required non-python binaries via conda
FROM quay.io/condaforge/miniforge3:latest AS build-venv
RUN apt -qq update && apt -qq install -y build-essential
RUN conda create -p /venv python=3.12
RUN /venv/bin/pip install --upgrade -q pip wheel setuptools
RUN conda install -p /venv -q -y eccodes zarr

# Build the virtualenv
FROM build AS build-venv
RUN /venv/bin/python -m pip install zarr xarray ocf_blosc2 huggingface_hub requests
# * We don't want the bufr eccodes definitions so save space by deleting them
FROM build-venv as install-reqs
RUN /venv/bin/python -m pip install -q xarray ocf_blosc2 huggingface_hub requests
RUN rm -r /venv/share/eccodes/definitions/bufr

# Copy the virtualenv into a distroless image
FROM gcr.io/distroless/python3-debian11
COPY --from=build-venv /venv /venv
COPY --from=install-reqs /venv /venv
COPY . /app
WORKDIR /app
ENTRYPOINT ["/venv/bin/python3", "download_combine_upload_icon.py"]

0 comments on commit cef3110

Please sign in to comment.