# syntax=docker/dockerfile:experimental # # Build stage: Install eccodes for handling BUFR files. # ARG base_tag FROM eccr-dev.ecmwf.int/servicelib/servicelib:${base_tag} AS build # Install ecbuild and other build-time dependencies. USER root RUN \ --mount=type=cache,target=/var/cache/apt,id=apt-cache,sharing=locked \ --mount=type=cache,target=/var/lib/apt,id=apt-lib,sharing=locked \ set -ex \ && apt-get update \ && apt-get install --yes --no-install-suggests --no-install-recommends \ ca-certificates \ cmake \ gcc \ git \ libc-dev \ make RUN \ --mount=type=cache,target=/src,sharing=shared \ --mount=type=cache,target=/build/ecbuild-debian,sharing=shared \ --mount=type=secret,id=netrc,target=/root/.netrc \ set -eux \ && test -d /src/ecbuild || git clone https://git.ecmwf.int/scm/ecsdk/ecbuild /src/ecbuild \ && cd /src/ecbuild \ && git checkout 2020.01.0 \ && cd /build/ecbuild-debian \ && cmake /src/ecbuild \ && make -j $(nproc) \ && make install # Install eccodes RUN \ --mount=type=cache,target=/src,sharing=shared \ --mount=type=cache,target=/build/eccodes-debian,sharing=shared \ --mount=type=secret,id=netrc,target=/root/.netrc \ set -eux \ && test -d /src/eccodes || git clone https://git.ecmwf.int/scm/eccodes/eccodes /src/eccodes \ && cd /src/eccodes \ && git checkout 2020.01.0 \ && cd /build/eccodes-debian \ && /usr/local/bin/ecbuild \ -DCMAKE_BUILD_TYPE=Release \ -DENABLE_FORTRAN=OFF \ -DENABLE_PYTHON=OFF \ /src/eccodes \ && make -j $(nproc) \ && make install # # Run-time stage. # FROM eccr-dev.ecmwf.int/servicelib/servicelib:${base_tag} # Copy the bits of eccodes that we need. COPY --from=build /usr/local/bin/bufr_* /usr/local/bin/ COPY --from=build /usr/local/lib/libeccodes.so /usr/local/lib/ COPY --from=build /usr/local/share/eccodes/ /usr/local/share/eccodes/ # Copy the Python services code. COPY *.py /code/services/bufr/ # Copy the default configuration file COPY servicelib.ini /etc/servicelib.ini