diff --git a/docker-bake.hcl b/docker-bake.hcl index c781d2e9a0..466e7a8c4e 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,12 +1,14 @@ -target "proto-files" { - context = "./" - dockerfile = "dockerfiles/proto-files.Dockerfile" -} - target "typescript-proto-client" { - context = "./" - dockerfile = "dockerfiles/typescript-proto-client.Dockerfile" contexts = { proto-files = "target:proto-files" } + output = [ + "type=local,dest=login/packages/zitadel-proto" + ] +} + +target "typescript-proto-client-out" { + output = [ + "type=local,dest=login/packages/zitadel-proto" + ] } diff --git a/dockerfiles/proto-files.Dockerfile b/dockerfiles/proto-files.Dockerfile index edbf3bc804..0af3346096 100644 --- a/dockerfiles/proto-files.Dockerfile +++ b/dockerfiles/proto-files.Dockerfile @@ -1,2 +1,8 @@ -FROM scratch AS proto-files +FROM bufbuild/buf:1.54.0 AS proto-files +RUN buf export https://github.com/envoyproxy/protoc-gen-validate.git --path validate --output /proto-files && \ + buf export https://github.com/grpc-ecosystem/grpc-gateway.git --path protoc-gen-openapiv2 --output /proto-files && \ + buf export https://github.com/googleapis/googleapis.git --path google/api/annotations.proto --path google/api/http.proto --path google/api/field_behavior.proto --output /proto-files + +FROM scratch +COPY --from=proto-files /proto-files / COPY ./proto / diff --git a/dockerfiles/typescript-proto-client.Dockerfile b/dockerfiles/typescript-proto-client.Dockerfile index 17eab4ee95..807ef4359c 100644 --- a/dockerfiles/typescript-proto-client.Dockerfile +++ b/dockerfiles/typescript-proto-client.Dockerfile @@ -2,7 +2,13 @@ FROM login-pnpm AS typescript-proto-client COPY ./login/packages/zitadel-proto/package.json ./packages/zitadel-proto/ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ pnpm install --frozen-lockfile --workspace-root --filter zitadel-proto -COPY --from=proto-files / ./packages/zitadel-proto/proto +COPY --from=proto-files /buf.yaml /buf.lock /proto-files/ +COPY --from=proto-files /zitadel /proto-files/zitadel COPY ./login/packages/zitadel-proto/buf.gen.yaml ./packages/zitadel-proto/ -RUN ls -la packages/zitadel-proto -RUN cd packages/zitadel-proto && pnpm exec buf generate . --path ./proto/zitadel +RUN ls /proto-files && cd packages/zitadel-proto && pnpm exec buf generate /proto-files + +FROM scratch AS typescript-proto-client-out +COPY --from=typescript-proto-client /build/packages/zitadel-proto/zitadel /zitadel +COPY --from=typescript-proto-client /build/packages/zitadel-proto/google /google +COPY --from=typescript-proto-client /build/packages/zitadel-proto/protoc-gen-openapiv2 /protoc-gen-openapiv2 +COPY --from=typescript-proto-client /build/packages/zitadel-proto/validate /validate