Refactor builds to use cache package

Use the upstream cache package to implement builds more clearly and
efficiently. This follows the patterns introduced in the deploy package.