|
1 | 1 | steps: |
2 | | - - id: docker_buildx |
| 2 | + - id: buildkit |
3 | 3 | name: docker:20.10 |
| 4 | + env: |
| 5 | + - "DOCKER_BUILDKIT=1" |
| 6 | + entrypoint: "docker" |
4 | 7 | args: |
| 8 | + - image |
5 | 9 | - build |
6 | | - - --target=docker |
7 | 10 | - --build-arg=DOCKER_VERSION=${_DOCKER_VERSION} |
8 | | - - --build-arg=BUILDX_VERSION=${_BUILDX_VERSION} |
9 | | - - --tag=docker-buildx:cloudbuild |
10 | | - - --file=hack/dockerfiles/buildx.dockerfile |
11 | | - - hack/dockerfiles |
12 | | - env: |
13 | | - - "DOCKER_BUILDKIT=1" |
| 11 | + - --build-arg=BUILDKIT_VERSION=${_BUILDKIT_VERSION} |
| 12 | + - -t |
| 13 | + - buildkit:cloudbuild |
| 14 | + - --target=buildkit |
| 15 | + - --file=./hack/dockerfiles/buildkit.dockerfile |
| 16 | + - ./hack/dockerfiles |
14 | 17 | waitFor: |
15 | 18 | - "-" |
16 | 19 |
|
17 | | - - id: bootstrap_buildx |
18 | | - name: docker-buildx:cloudbuild |
| 20 | + - id: bootstrap_buildkitd |
| 21 | + name: buildkit:cloudbuild |
| 22 | + entrypoint: "docker" |
19 | 23 | args: |
20 | | - - buildx |
21 | | - - create |
22 | | - - --bootstrap |
23 | | - - --name=cloudbuild |
24 | | - - --driver=docker-container |
25 | | - - --driver-opt=image=moby/buildkit:nightly |
26 | | - - --driver-opt=network=cloudbuild |
27 | | - - --use |
| 24 | + - container |
| 25 | + - run |
| 26 | + - --detach |
| 27 | + - --privileged |
| 28 | + - --name=buildkitd |
| 29 | + - --network=cloudbuild |
| 30 | + - moby/buildkit:${_BUILDKIT_VERSION} |
28 | 31 | waitFor: |
29 | | - - "docker_buildx" |
| 32 | + - "buildkit" |
30 | 33 |
|
31 | 34 | - id: protoc-builder |
32 | | - name: docker-buildx:cloudbuild |
| 35 | + name: buildkit:cloudbuild |
| 36 | + entrypoint: "buildctl" |
33 | 37 | args: |
34 | | - - buildx |
| 38 | + - --addr=docker-container://buildkitd |
35 | 39 | - build |
36 | | - - --target=protoc-builder |
37 | | - - --build-arg=BUILDKIT_INLINE_CACHE=1 |
38 | | - - --build-arg=PROTOC_VERSION=${_PROTOC_VERSION} |
39 | | - - --build-arg=GOLANG_VERSION=${_GOLANG_VERSION} |
40 | | - - --build-arg=ALPINE_VERSION=${_ALPINE_VERSION} |
41 | | - - --cache-from=type=registry,ref=gcr.io/$PROJECT_ID/protoc/protoc-builder:cloudbuild_cache |
42 | | - - --output=type=image,name=gcr.io/$PROJECT_ID/protoc/protoc-builder:cloudbuild_cache,push=true |
43 | | - - . |
| 40 | + - --frontend=dockerfile.v0 |
| 41 | + - --local=context=/workspace |
| 42 | + - --local=dockerfile=/workspace |
| 43 | + - --opt=target=protoc-builder |
| 44 | + - --opt=build-arg:PROTOC_VERSION=${_PROTOC_VERSION} |
| 45 | + - --opt=build-arg:GOLANG_VERSION=${_GOLANG_VERSION} |
| 46 | + - --opt=build-arg:ALPINE_VERSION=${_ALPINE_VERSION} |
| 47 | + - --export-cache=type=inline |
| 48 | + - --import-cache=type=registry,ref=gcr.io/$PROJECT_ID/protoc/protoc-builder:cloudbuild_cache |
44 | 49 | waitFor: |
45 | | - - "bootstrap_buildx" |
| 50 | + - "bootstrap_buildkitd" |
46 | 51 |
|
47 | 52 | - id: protoc |
48 | | - name: docker-buildx:cloudbuild |
| 53 | + name: buildkit:cloudbuild |
| 54 | + entrypoint: "buildctl" |
49 | 55 | args: |
50 | | - - buildx |
| 56 | + - --addr=docker-container://buildkitd |
51 | 57 | - build |
52 | | - - --target=protoc |
53 | | - - --build-arg=PROTOC_VERSION=${_PROTOC_VERSION} |
54 | | - - --build-arg=GOLANG_VERSION=${_GOLANG_VERSION} |
55 | | - - --build-arg=ALPINE_VERSION=${_ALPINE_VERSION} |
56 | | - - --tag=gcr.io/$PROJECT_ID/protoc/protoc:${_PROTOC_VERSION} |
57 | | - - --load |
58 | | - - . |
| 58 | + - --frontend=dockerfile.v0 |
| 59 | + - --local=context=/workspace |
| 60 | + - --local=dockerfile=/workspace |
| 61 | + - --opt=target=protoc |
| 62 | + - --opt=build-arg:PROTOC_VERSION=${_PROTOC_VERSION} |
| 63 | + - --opt=build-arg:GOLANG_VERSION=${_GOLANG_VERSION} |
| 64 | + - --opt=build-arg:ALPINE_VERSION=${_ALPINE_VERSION} |
| 65 | + - --output=type=image,name=gcr.io/$PROJECT_ID/protoc/protoc:${_PROTOC_VERSION},push=true,oci-mediatypes=true,compression=estargz |
| 66 | + - --import-cache=type=registry,ref=gcr.io/$PROJECT_ID/protoc/protoc-builder:cloudbuild_cache |
59 | 67 | waitFor: |
60 | 68 | - "protoc-builder" |
61 | 69 |
|
62 | 70 | - id: protoc-debug |
63 | | - name: docker-buildx:cloudbuild |
| 71 | + name: buildkit:cloudbuild |
| 72 | + entrypoint: "buildctl" |
64 | 73 | args: |
65 | | - - buildx |
| 74 | + - --addr=docker-container://buildkitd |
66 | 75 | - build |
67 | | - - --target=protoc-debug |
68 | | - - --build-arg=PROTOC_VERSION=${_PROTOC_VERSION} |
69 | | - - --build-arg=GOLANG_VERSION=${_GOLANG_VERSION} |
70 | | - - --build-arg=ALPINE_VERSION=${_ALPINE_VERSION} |
71 | | - - --tag=gcr.io/$PROJECT_ID/protoc/protoc:${_PROTOC_VERSION}-debug |
72 | | - - --load |
73 | | - - . |
| 76 | + - --frontend=dockerfile.v0 |
| 77 | + - --local=context=/workspace |
| 78 | + - --local=dockerfile=/workspace |
| 79 | + - --opt=target=protoc-debug |
| 80 | + - --opt=build-arg:PROTOC_VERSION=${_PROTOC_VERSION} |
| 81 | + - --opt=build-arg:GOLANG_VERSION=${_GOLANG_VERSION} |
| 82 | + - --opt=build-arg:ALPINE_VERSION=${_ALPINE_VERSION} |
| 83 | + - --output=type=image,name=gcr.io/$PROJECT_ID/protoc/protoc:${_PROTOC_VERSION}-debug,push=true,oci-mediatypes=true,compression=estargz |
| 84 | + - --import-cache=type=registry,ref=gcr.io/$PROJECT_ID/protoc/protoc-builder:cloudbuild_cache |
74 | 85 | waitFor: |
75 | 86 | - "protoc-builder" |
76 | 87 |
|
77 | 88 | - id: golang-builder |
78 | | - name: docker-buildx:cloudbuild |
| 89 | + name: buildkit:cloudbuild |
| 90 | + entrypoint: "buildctl" |
79 | 91 | args: |
80 | | - - buildx |
| 92 | + - --addr=docker-container://buildkitd |
81 | 93 | - build |
82 | | - - --target=golang-builder |
83 | | - - --build-arg=BUILDKIT_INLINE_CACHE=1 |
84 | | - - --build-arg=PROTOC_VERSION=${_PROTOC_VERSION} |
85 | | - - --build-arg=GOLANG_VERSION=${_GOLANG_VERSION} |
86 | | - - --build-arg=ALPINE_VERSION=${_ALPINE_VERSION} |
87 | | - - --build-arg=PROTOC_GEN_GO_VERSION=${_PROTOC_GEN_GO_VERSION} |
88 | | - - --build-arg=PROTOC_GEN_GO_GRPC_VERSION=${_PROTOC_GEN_GO_GRPC_VERSION} |
89 | | - - --cache-from=type=registry,ref=gcr.io/$PROJECT_ID/protoc/golang-builder:cloudbuild_cache |
90 | | - - --output=type=image,name=gcr.io/$PROJECT_ID/protoc/golang-builder:cloudbuild_cache,push=true |
91 | | - - . |
92 | | - waitFor: |
93 | | - - "protoc" |
94 | | - - "protoc-debug" |
| 94 | + - --frontend=dockerfile.v0 |
| 95 | + - --local=context=/workspace |
| 96 | + - --local=dockerfile=/workspace |
| 97 | + - --opt=target=golang-builder |
| 98 | + - --opt=build-arg:PROTOC_VERSION=${_PROTOC_VERSION} |
| 99 | + - --opt=build-arg:GOLANG_VERSION=${_GOLANG_VERSION} |
| 100 | + - --opt=build-arg:ALPINE_VERSION=${_ALPINE_VERSION} |
| 101 | + - --opt=build-arg:PROTOC_GEN_GO_VERSION=${_PROTOC_GEN_GO_VERSION} |
| 102 | + - --opt=build-arg:PROTOC_GEN_GO_GRPC_VERSION=${_PROTOC_GEN_GO_GRPC_VERSION} |
| 103 | + - --export-cache=type=inline |
| 104 | + - --import-cache=type=registry,ref=gcr.io/$PROJECT_ID/protoc/protoc-builder:cloudbuild_cache |
95 | 105 |
|
96 | 106 | - id: golang |
97 | | - name: docker-buildx:cloudbuild |
| 107 | + name: buildkit:cloudbuild |
| 108 | + entrypoint: "buildctl" |
98 | 109 | args: |
99 | | - - buildx |
| 110 | + - --addr=docker-container://buildkitd |
100 | 111 | - build |
101 | | - - --target=golang |
102 | | - - --build-arg=PROTOC_VERSION=${_PROTOC_VERSION} |
103 | | - - --build-arg=GOLANG_VERSION=${_GOLANG_VERSION} |
104 | | - - --build-arg=ALPINE_VERSION=${_ALPINE_VERSION} |
105 | | - - --build-arg=PROTOC_GEN_GO_VERSION=${_PROTOC_GEN_GO_VERSION} |
106 | | - - --build-arg=PROTOC_GEN_GO_GRPC_VERSION=${_PROTOC_GEN_GO_GRPC_VERSION} |
107 | | - - --tag=gcr.io/$PROJECT_ID/protoc/golang:${_PROTOC_VERSION}-${_GOLANG_VERSION} |
108 | | - - --load |
109 | | - - . |
| 112 | + - --frontend=dockerfile.v0 |
| 113 | + - --local=context=/workspace |
| 114 | + - --local=dockerfile=/workspace |
| 115 | + - --opt=target=golang |
| 116 | + - --opt=build-arg:PROTOC_VERSION=${_PROTOC_VERSION} |
| 117 | + - --opt=build-arg:GOLANG_VERSION=${_GOLANG_VERSION} |
| 118 | + - --opt=build-arg:ALPINE_VERSION=${_ALPINE_VERSION} |
| 119 | + - --opt=build-arg:PROTOC_GEN_GO_VERSION=${_PROTOC_GEN_GO_VERSION} |
| 120 | + - --opt=build-arg:PROTOC_GEN_GO_GRPC_VERSION=${_PROTOC_GEN_GO_GRPC_VERSION} |
| 121 | + - --output=type=image,name=gcr.io/$PROJECT_ID/protoc/golang:${_PROTOC_VERSION}-${_GOLANG_VERSION},push=true,oci-mediatypes=true,compression=estargz |
| 122 | + - --import-cache=type=registry,ref=gcr.io/$PROJECT_ID/protoc/cache/golang:${_PROTOC_VERSION}-${_GOLANG_VERSION}:cloudbuild_cache |
110 | 123 | waitFor: |
| 124 | + - "protoc" |
111 | 125 | - "golang-builder" |
112 | 126 |
|
113 | 127 | - id: golang-debug |
114 | | - name: docker-buildx:cloudbuild |
| 128 | + name: buildkit:cloudbuild |
| 129 | + entrypoint: "buildctl" |
115 | 130 | args: |
116 | | - - buildx |
| 131 | + - --addr=docker-container://buildkitd |
117 | 132 | - build |
118 | | - - --target=golang-debug |
119 | | - - --build-arg=PROTOC_VERSION=${_PROTOC_VERSION} |
120 | | - - --build-arg=GOLANG_VERSION=${_GOLANG_VERSION} |
121 | | - - --build-arg=ALPINE_VERSION=${_ALPINE_VERSION} |
122 | | - - --build-arg=PROTOC_GEN_GO_VERSION=${_PROTOC_GEN_GO_VERSION} |
123 | | - - --build-arg=PROTOC_GEN_GO_GRPC_VERSION=${_PROTOC_GEN_GO_GRPC_VERSION} |
124 | | - - --tag=gcr.io/$PROJECT_ID/protoc/golang:${_PROTOC_VERSION}-${_GOLANG_VERSION}-debug |
125 | | - - --load |
126 | | - - . |
| 133 | + - --frontend=dockerfile.v0 |
| 134 | + - --local=context=/workspace |
| 135 | + - --local=dockerfile=/workspace |
| 136 | + - --opt=target=golang-debug |
| 137 | + - --opt=build-arg:PROTOC_VERSION=${_PROTOC_VERSION} |
| 138 | + - --opt=build-arg:GOLANG_VERSION=${_GOLANG_VERSION} |
| 139 | + - --opt=build-arg:ALPINE_VERSION=${_ALPINE_VERSION} |
| 140 | + - --opt=build-arg:PROTOC_GEN_GO_VERSION=${_PROTOC_GEN_GO_VERSION} |
| 141 | + - --opt=build-arg:PROTOC_GEN_GO_GRPC_VERSION=${_PROTOC_GEN_GO_GRPC_VERSION} |
| 142 | + - --output=type=image,name=gcr.io/$PROJECT_ID/protoc/golang:${_PROTOC_VERSION}-${_GOLANG_VERSION}-debug,push=true,oci-mediatypes=true,compression=estargz |
| 143 | + - --import-cache=type=registry,ref=gcr.io/$PROJECT_ID/protoc/protoc-builder:cloudbuild_cache |
127 | 144 | waitFor: |
| 145 | + - "protoc-debug" |
128 | 146 | - "golang-builder" |
129 | 147 |
|
130 | 148 | substitutions: |
131 | 149 | _DOCKER_VERSION: "20.10" |
132 | | - _BUILDX_VERSION: "0.7.0-rc1" # https://github.com/docker/buildx/releases/tag/v0.7.0-rc1 |
133 | | - _PROTOC_VERSION: "3.19.0" # https://github.com/protocolbuffers/protobuf/releases/tag/v3.19.0 |
| 150 | + _BUILDKIT_VERSION: "v0.10.0" |
| 151 | + _PROTOC_VERSION: "3.19.4" # https://github.com/protocolbuffers/protobuf/releases/tag/v3.19.0 |
134 | 152 | _GOLANG_VERSION: "1.17" |
135 | | - _ALPINE_VERSION: "3.14" |
| 153 | + _ALPINE_VERSION: "3.15" |
136 | 154 | _PROTOC_GEN_GO_VERSION: "v1.27.1" # https://github.com/protocolbuffers/protobuf-go/releases/tag/v1.27.1 |
137 | 155 | _PROTOC_GEN_GO_GRPC_VERSION: "9c668aeab869" # https://github.com/grpc/grpc-go/tree/9c668aeab869 |
138 | 156 |
|
139 | | -# images: |
140 | | -# - "gcr.io/$PROJECT_ID/protoc/protoc:${_PR_NUMBER:-${_PROTOC_VERSION}}" |
141 | | -# - "gcr.io/$PROJECT_ID/protoc/protoc:${_PR_NUMBER:-${_PROTOC_VERSION}}-debug" |
142 | | -# - "gcr.io/$PROJECT_ID/protoc/golang:${_PR_NUMBER:-${_PROTOC_VERSION}-${_GOLANG_VERSION}}" |
143 | | -# - "gcr.io/$PROJECT_ID/protoc/golang:${_PR_NUMBER:-${_PROTOC_VERSION}-${_GOLANG_VERSION}}-debug" |
144 | | - |
145 | 157 | tags: |
146 | 158 | - "protoc.protoc" |
147 | 159 | - "protoc.golang" |
|
0 commit comments