# Build VM Strategy Design ## Overview ```mermaid sequenceDiagram actor User participant Host participant SharedVolumes participant DockerContainer User->>+Host: polywrap build --strategy=vm Host->>SharedVolumes: Copy polywrap manifests Host->>SharedVolumes: Copy linked packages Host->>SharedVolumes: Copy and overwrite additional includes Host->>SharedVolumes: Copy and overwrite sources Host->>Host: Generate build script Host->>DockerContainer: Pull base image, instantiate container and mount shared volumes DockerContainer->>DockerContainer: Execute build script DockerContainer->>SharedVolumes: Write build outputs SharedVolumes->>Host: Copy build outputs ``` ## Notable implementation details - Shared volumes directories are not automatically deleted, they're preserved in `.polywrap` cache directory - Only what's inside the build scripts get executed inside of the Docker Container - The Docker container is automatically destroyed after build script execution - Build script gets saved in `.polywrap` for auditing/debugging purposes - Shared volumes start as cache directories inside `.polywrap` directory, things get copied over and at the moment of container instantiation, they're mounted as volumes