-
Notifications
You must be signed in to change notification settings - Fork 690
/
Dockerfile.proto
47 lines (32 loc) · 1.54 KB
/
Dockerfile.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
FROM docker.io/golang:1.21.9-bullseye@sha256:311468bffa9fa4747a334b94e6ce3681b564126d653675a6adc46698b2b88d35 AS go-tools
RUN mkdir /app
COPY tools/build.sh /app/tools/
COPY tools/go.* /app/tools/
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
cd /app/tools && CGO_ENABLED=0 ./build.sh
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
FROM docker.io/golang:1.21.9-bullseye@sha256:311468bffa9fa4747a334b94e6ce3681b564126d653675a6adc46698b2b88d35 AS go-build
COPY --from=go-tools /app /app
COPY buf.* /app
COPY proto /app/proto
RUN --mount=type=cache,target=/root/.cache \
cd /app && \
tools/bin/buf lint && \
tools/bin/buf generate
FROM node:16-alpine@sha256:004dbac84fed48e20f9888a23e32fa7cf83c2995e174a78d41d9a9dd1e051a20 AS node-build
COPY --from=go-tools /app /app
COPY buf.* /app
COPY proto /app/proto
COPY tools/package.json /app/tools/
COPY tools/package-lock.json /app/tools/
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/root/.npm \
cd /app/tools && npm ci
RUN --mount=type=cache,target=/root/.cache \
cd /app && \
tools/bin/buf generate --template buf.gen.web.yaml
FROM scratch AS go-export
COPY --from=go-build /app/node/pkg/proto pkg/proto
FROM scratch AS node-export
COPY --from=node-build /app/sdk/js-proto-web/src sdk/js-proto-web/src
COPY --from=node-build /app/sdk/js-proto-node/src sdk/js-proto-node/src