forked from wormhole-foundation/wormhole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.proto
62 lines (44 loc) · 1.99 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
FROM docker.io/golang:1.17.5@sha256:90d1ab81f3d157ca649a9ff8d251691b810d95ea6023a03cdca139df58bca599 AS go-tools
# Support additional root CAs
COPY README.md cert.pem* /certs/
# Debian
RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/certs/ca-certificates.crt; fi
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.17.5@sha256:90d1ab81f3d157ca649a9ff8d251691b810d95ea6023a03cdca139df58bca599 AS go-build
# Support additional root CAs
COPY README.md cert.pem* /certs/
# Debian
RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/certs/ca-certificates.crt; fi
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
# Support additional root CAs
COPY README.md cert.pem* /certs/
# Alpine
RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/cert.pem; fi
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