Skip to content

Commit 84075fd

Browse files
committed
Improved the performance of generated-files.Dockerfile by skipping packaging of unused files
1 parent 9def9e5 commit 84075fd

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

hack/dockerfiles/generated-files.Dockerfile

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
ARG GO_VERSION=1.23
44
ARG DEBIAN_VERSION=bookworm
55
ARG PROTOC_VERSION=3.11.4
6-
ARG PROTOC_GOOGLEAPIS_VERSION=2af421884dd468d565137215c946ebe4e245ae26
76

87
# protoc is dynamically linked to glibc so can't use alpine base
98

@@ -22,16 +21,6 @@ RUN <<EOT
2221
unzip protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip -d /opt/protoc
2322
EOT
2423

25-
FROM base AS googleapis
26-
ARG PROTOC_GOOGLEAPIS_VERSION
27-
RUN <<EOT
28-
set -e
29-
wget -q https://github.com/googleapis/googleapis/archive/${PROTOC_GOOGLEAPIS_VERSION}.zip -O googleapis.zip
30-
unzip googleapis.zip '*.proto' -d /opt
31-
mkdir -p /opt/googleapis
32-
mv /opt/googleapis-${PROTOC_GOOGLEAPIS_VERSION} /opt/googleapis/include
33-
EOT
34-
3524
FROM base AS gobuild-base
3625
WORKDIR /app
3726

@@ -41,10 +30,10 @@ RUN --mount=type=bind,source=go.mod,target=/app/go.mod \
4130
--mount=type=cache,target=/root/.cache \
4231
--mount=type=cache,target=/go/pkg/mod <<EOT
4332
set -e
44-
mkdir -p /opt/vtprotobuf
33+
mkdir -p /opt/vtprotobuf/include/github.com/planetscale/vtprotobuf/vtproto
4534
go mod download github.com/planetscale/vtprotobuf
46-
cp -R $(go list -m -f='{{.Dir}}' github.com/planetscale/vtprotobuf)/include /opt/vtprotobuf
47-
chmod -R 0755 /opt/vtprotobuf
35+
cp $(go list -m -f='{{.Dir}}' github.com/planetscale/vtprotobuf)/include/github.com/planetscale/vtprotobuf/vtproto/ext.proto /opt/vtprotobuf/include/github.com/planetscale/vtprotobuf/vtproto/ext.proto
36+
chmod 0644 /opt/vtprotobuf/include/github.com/planetscale/vtprotobuf/vtproto/ext.proto
4837
EOT
4938

5039
FROM gobuild-base AS vendored
@@ -56,7 +45,6 @@ EOT
5645

5746
FROM scratch AS protobuf
5847
COPY --link --from=protoc /opt/protoc /
59-
COPY --link --from=googleapis /opt/googleapis /
6048
COPY --link --from=vtprotobuf /opt/vtprotobuf /
6149
COPY --link --from=vendored /opt/vendored /
6250

0 commit comments

Comments
 (0)