-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce layers in prost plugins (#1288)
- Loading branch information
Showing
7 changed files
with
42 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
# syntax=docker/dockerfile:1.7 | ||
FROM rust:1.76.0-alpine3.19 as builder | ||
RUN apk add --no-cache musl-dev | ||
WORKDIR /app | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ | ||
cargo install protoc-gen-prost-crate --version 0.4.0 --locked --root /app | ||
|
||
FROM gcr.io/distroless/static | ||
COPY --from=builder /app/bin/protoc-gen-prost-crate /protoc-gen-prost-crate | ||
FROM gcr.io/distroless/static-debian12:latest@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05 AS base | ||
|
||
FROM scratch | ||
COPY --link --from=base / / | ||
COPY --link --from=builder /app/bin/protoc-gen-prost-crate /protoc-gen-prost-crate | ||
USER nobody | ||
ENTRYPOINT ["/protoc-gen-prost-crate"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
# syntax=docker/dockerfile:1.7 | ||
FROM rust:1.76.0-alpine3.19 as builder | ||
RUN apk add --no-cache musl-dev | ||
WORKDIR /app | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ | ||
cargo install protoc-gen-prost-serde --version 0.3.0 --locked --root /app | ||
|
||
FROM gcr.io/distroless/static | ||
COPY --from=builder /app/bin/protoc-gen-prost-serde /protoc-gen-prost-serde | ||
FROM gcr.io/distroless/static-debian12:latest@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05 AS base | ||
|
||
FROM scratch | ||
COPY --link --from=base / / | ||
COPY --link --from=builder /app/bin/protoc-gen-prost-serde /protoc-gen-prost-serde | ||
USER nobody | ||
ENTRYPOINT ["/protoc-gen-prost-serde"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
# syntax=docker/dockerfile:1.7 | ||
FROM rust:1.70.0-alpine3.18 as builder | ||
RUN apk add --no-cache musl-dev | ||
WORKDIR /app | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ | ||
cargo install protoc-gen-prost --version 0.2.3 --locked --root /app | ||
|
||
FROM gcr.io/distroless/static | ||
COPY --from=builder /app/bin/protoc-gen-prost /protoc-gen-prost | ||
FROM gcr.io/distroless/static-debian12:latest@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05 AS base | ||
|
||
FROM scratch | ||
COPY --link --from=base / / | ||
COPY --link --from=builder /app/bin/protoc-gen-prost /protoc-gen-prost | ||
USER nobody | ||
ENTRYPOINT ["/protoc-gen-prost"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
# syntax=docker/dockerfile:1.7 | ||
FROM rust:1.76.0-alpine3.19 as builder | ||
RUN apk add --no-cache musl-dev | ||
WORKDIR /app | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ | ||
cargo install protoc-gen-prost --version 0.3.0 --locked --root /app | ||
|
||
FROM gcr.io/distroless/static | ||
COPY --from=builder /app/bin/protoc-gen-prost /protoc-gen-prost | ||
FROM gcr.io/distroless/static-debian12:latest@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05 AS base | ||
|
||
FROM scratch | ||
COPY --link --from=base / / | ||
COPY --link --from=builder /app/bin/protoc-gen-prost /protoc-gen-prost | ||
USER nobody | ||
ENTRYPOINT ["/protoc-gen-prost"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
# syntax=docker/dockerfile:1.7 | ||
FROM rust:1.76.0-alpine3.19 as builder | ||
RUN apk add --no-cache musl-dev | ||
WORKDIR /app | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ | ||
cargo install protoc-gen-prost --version 0.3.1 --locked --root /app | ||
|
||
FROM gcr.io/distroless/static | ||
COPY --from=builder /app/bin/protoc-gen-prost /protoc-gen-prost | ||
FROM gcr.io/distroless/static-debian12:latest@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05 AS base | ||
|
||
FROM scratch | ||
COPY --link --from=base / / | ||
COPY --link --from=builder /app/bin/protoc-gen-prost /protoc-gen-prost | ||
USER nobody | ||
ENTRYPOINT ["/protoc-gen-prost"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
# syntax=docker/dockerfile:1.7 | ||
FROM rust:1.70.0-alpine3.18 as builder | ||
RUN apk add --no-cache musl-dev | ||
WORKDIR /app | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ | ||
cargo install protoc-gen-tonic --version 0.3.0 --locked --root /app | ||
|
||
FROM gcr.io/distroless/static | ||
COPY --from=builder /app/bin/protoc-gen-tonic /protoc-gen-tonic | ||
FROM gcr.io/distroless/static-debian12:latest@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05 AS base | ||
|
||
FROM scratch | ||
COPY --link --from=base / / | ||
COPY --link --from=builder /app/bin/protoc-gen-tonic /protoc-gen-tonic | ||
USER nobody | ||
ENTRYPOINT ["/protoc-gen-tonic"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
# syntax=docker/dockerfile:1.7 | ||
FROM rust:1.76.0-alpine3.19 as builder | ||
RUN apk add --no-cache musl-dev | ||
WORKDIR /app | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked --mount=type=cache,target=/root/target \ | ||
cargo install protoc-gen-tonic --version 0.4.0 --locked --root /app | ||
|
||
FROM gcr.io/distroless/static | ||
COPY --from=builder /app/bin/protoc-gen-tonic /protoc-gen-tonic | ||
FROM gcr.io/distroless/static-debian12:latest@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05 AS base | ||
|
||
FROM scratch | ||
COPY --link --from=base / / | ||
COPY --link --from=builder /app/bin/protoc-gen-tonic /protoc-gen-tonic | ||
USER nobody | ||
ENTRYPOINT ["/protoc-gen-tonic"] |