diff --git a/Containerfile b/Containerfile index f3d1b15d..3727e7cc 100644 --- a/Containerfile +++ b/Containerfile @@ -8,15 +8,18 @@ RUN /venv/bin/pip install --upgrade pip wheel setuptools RUN conda install -p /venv -y eccodes zarr # Install packages into the virtualenv as a separate step -# * Only re-execute this step when the copied files change -# * This also builds the package into the virtualenv +# * Only re-execute this step when the requirements files change +FROM build-venv AS build-reqs +WORKDIR /app +COPY pyproject.toml pyproject.toml +RUN /venv/bin/pip install . --no-cache-dir --no-binary=nwp-consumer + +# Build binary for the package # * The package is versioned via setuptools_git_versioning # hence the .git directory is required # * The README.md is required for the long description -FROM build-venv AS build-wheels -WORKDIR /app +FROM build-reqs AS build-app COPY src src -COPY pyproject.toml pyproject.toml COPY .git .git COPY README.md README.md RUN /venv/bin/pip install . @@ -25,7 +28,7 @@ RUN /venv/bin/pip install . # * These are small images that only contain the runtime dependencies FROM gcr.io/distroless/python3-debian11 WORKDIR /app -COPY --from=build-wheels /venv /venv +COPY --from=build-app /venv /venv HEALTHCHECK CMD ["/venv/bin/nwp-consumer", "check"] ENTRYPOINT ["/venv/bin/nwp-consumer"] VOLUME /tmp/nwpc diff --git a/pyproject.toml b/pyproject.toml index c9f27d16..377a6462 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,11 +49,6 @@ nwp-consumer = "nwp_consumer.cmd.main:main" # Set the entrypoint for the CLI [project.urls] repository = "https://github.com/openclimatefix/nwp-consumer" -[tool.setuptools.packages.find] -where = ["src"] -include = ["nwp_consumer"] -exclude = ["*.tests", "*.tests.*", "tests.*", "tests"] - [tool.setuptools-git-versioning] enabled = true