Stability-AI / api-interfaces

Interface definitions for API interactions between components
140 stars 78 forks source link

Docker build #22

Closed palp closed 1 year ago

palp commented 1 year ago

This change adds a Dockerfile to make a consistent build environment easily available.

salanki commented 1 year ago

Will this build for both python and js?

palp commented 1 year ago

Will this build for both python and js?

Yeah, and thinking on it, I'd like to exclude those files from the build to ensure they get freshly compiled each run, since the output is checked in - that'd make it easily testable too.

palp commented 1 year ago

One notable tradeoff here is that I decided on compiling protobuf and grpc rather than relying on binaries/packages - with cached images this seems fine and I think that's the best way to ensure we can have the latest versions of those cleanly.

palp commented 1 year ago

I've added a workflow to build using this image that uploads the output as an artifact (see https://github.com/Stability-AI/api-interfaces/actions/runs/3132367601); my thinking is we could update #15 to depend on this and remove the build steps, keeping the check-in code, as well as publish the artifacts as a release - all scoped to main. This one can run on push (or PR and push to main) so there's a build check without publish.

We could also publish the output docker image, which could be used in builds like so: COPY --from=ghcr.io/Stability-AI/api-interfaces:latest /gooseai /src/gooseai This output image does not contain the build toolchain or source files.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information