docker build should not require any "prereq" steps like building the wheel on the host machine

Issue #67 resolved
Thomas Gilgenast created an issue

we would normally assume that you can git clone and then immediately docker build . but this assumption is currently being violated

this can be easily solved by making the existing image a “second stage“ and adding a first stage whose job it is to build the wheel

the $VERSION build arg only needs to be passed to the first stage - version information will be stored in the wheel after the first stage builds and the second stage can copy dist/*.whl from the builder to /install in the second stage and then pip install /install/*.whl

the end of this post has a good example of how to do this

Comments (4)

  1. Thomas Gilgenast reporter

    we have some preliminary progress on this in 7b2e46b

    to add back version information, we are considering using setuptools-scm instead of versioneer (versioneer is no longer maintained) since setuptools-scm appears to allow overriding the git-determined version via a simple SETUPTOOLS_SCM_PRETEND_VERSION environment variable

    a second problem to solve is that the app code gets copied to the builder image before the dependency wheels get copied to and installed in the final image - this means that the dep copy and dep install (but not dep build) steps will be repeated every time app code changes

  2. Thomas Gilgenast reporter

    finally fixes #67

    in this commit, we switched out versioneer for setuptools-scm

    this allows us to override the version information inside the docker image using a SETUPTOOLS_SCM_PRETEND_VERSION environment variable

    using setuptools-scm requires us to be more picky about how we control the inclusion of files into our sdists via MANIFEST.in

    we also incur a dependency on importlib_metadata, a pre-3.8 backport of importlib.metadata

    → <<cset af1acbd89646>>

  3. Log in to comment