| 1 |
FROM node:25@sha256:ccfc02deb6abb1b70b6ef21d3d93b3f671c0de6f463ff331cf0ea0a28ad875c9 AS typescript-builder |
| 2 |
RUN mkdir /app |
| 3 |
COPY hack/package*.json /app |
| 4 |
WORKDIR /app |
| 5 |
|
| 6 |
# this flattens the node_modules in a way similar to the global install (which we'll (ab)use in a second) |
| 7 |
RUN npm ci --install-strategy=shallow |
| 8 |
|
| 9 |
# /usr/bin/env is called from ts-proto but not in distroless by default; we use busybox for this |
| 10 |
FROM gcr.io/distroless/base-debian13:debug-nonroot@sha256:7f8dc86be3039dbc004c89848f906de44313c84026035348860abd5166622d3f AS env-source |
| 11 |
|
| 12 |
FROM gcr.io/distroless/nodejs24-debian13:nonroot@sha256:924918584d0e6793e578fc0e98b8b8026ae4ac2ccf2fea283bc54a7165441ccd |
| 13 |
|
| 14 |
# node is installed in a non-default location in distroless |
| 15 |
ENV PATH=$PATH:/nodejs/bin |
| 16 |
|
| 17 |
COPY --from=typescript-builder /app/node_modules /usr/local/lib/node_modules |
| 18 |
COPY --from=env-source /busybox/busybox /usr/bin/env |
| 19 |
COPY --from=protoc-base:typescript /protobuf/bin/protoc /usr/local/bin/ |
| 20 |
COPY --from=protoc-base:typescript /protobuf/include/google /opt/include/google |
| 21 |
COPY --from=protoc-base:typescript /googleapis /googleapis |
| 22 |
|
| 23 |
ENTRYPOINT ["/usr/local/bin/protoc", "--plugin=/usr/local/lib/node_modules/ts-proto/protoc-gen-ts_proto", "--ts_proto_opt=protoJsonFormat=false"] |