Configure Build spec and Auto-build
maincompose2nix supports the Compose build spec.
- Default behavior: A one-shot systemd service is generated for each container build. You must manually start this service to build the image before the container can run:
sudo systemctl start podman-build-my-service.service
- **Auto-build**: If you run `compose2nix` with the `-build=true` flag, the build service is marked as a dependency for the container service. This ensures the build runs automatically before the container starts.
**Warning**: Using `-build=true` means the build will be re-run on every restart of the root target or the system, which may update the image.
Manual build
sudo systemctl start podman-build-my-service.service
CLI flag for auto-build
compose2nix -build=true