Skip to content

Dockerfile should build rules-engine #116

@thadk

Description

@thadk

Right now the web app deployment only deploys an obsolete no-dependency python rules-engine file.
With the newest version of the Rules Engine in the repository, it is using a python package wheel (whl) file which needs to be built on every deployment.

The whl file is already getting built for use in the unit tests. The test is committed and passing.

But we can't use the Rules Engine whl file yet in the browser, and we'd like to. You can help.

We don't want to check in the whl file, but to build it "just-in-time" at the key places. There is a reference example to help you start. It runs whenever we do npm run test app/utils/pyodide.test.ts

Dockerfile build of the Python whl

  • Practice with local deployment of Docker first but after you get comfortable, instead of mv Dockerfile ./heat-stack as it instructs, try moving it to the root of the project.
  • Modify the heat-stack Dockerfile in a way so the ../rules-engine folder can do a build.
    • You need to figure out how to get the rules-engine folder into the built docker image.
  • In the Dockerfile, add a line to run the equivalent of these build commands that are running before vitest in the other package.json example:
    "test": "cd ../rules-engine && python3 -m venv venv && . venv/bin/activate && pip install -q build && python3 -m build && cd ../heat-stack && vitest",
  • Copy the generated file from rules-engine/dist/rules_engine-*-py3-none-any.whl
    • to heat-stack/public/pyodide-env

Optional: Package.json enable npm run dev to build & copy the whl

  • As a bonus task, modify the package.json dev line to build the whl just in time and place it in the same folder.
  • add the built file to .gitignore

Fix Github Actions to match

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions