Skip to content

Commit

Permalink
rpc: Refresh Docker for generating protobuf files.
Browse files Browse the repository at this point in the history
- Pull base image by digest, helping to avoid supply chain attacks.
- Use alpine base image instead of debian (245MB vs 837MB).
- Update from golang 1.21.0 to 1.23.1.
- Download specific version of protobuf from GitHub rather than whatever
  version happens to be provided by the base images package manager.
  • Loading branch information
jholdstock committed Sep 7, 2024
1 parent 5195fbb commit 6eb6479
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions rpc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
FROM golang:1.21.0-bookworm
# The image below is golang:1.23.1-alpine3.20 (linux/amd64)
# It's pulled by the digest (immutable id) to avoid supply-chain attacks.
# Maintainer Note:
# To update to a new digest, you must first manually pull the new image:
# `docker pull golang:<new version>`
# Docker will print the digest of the new image after the pull has finished.
FROM golang@sha256:7ed3ee46b57ffc90cc32b50c7d5f40b2bd452d2dc97e42d6e9da47067f266ef4

RUN apt-get update && apt-get install -y protobuf-compiler

WORKDIR /build/rpc
CMD ["/bin/bash", "regen.sh"]
ENV PB_REPO https://github.com/protocolbuffers/protobuf
ENV PB_VERSION 27.3

RUN wget $PB_REPO/releases/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip
RUN unzip protoc-$PB_VERSION-linux-x86_64.zip -d $HOME/protobuf
RUN mv $HOME/protobuf/bin/protoc /usr/local/bin

WORKDIR /build/rpc
CMD ["./regen.sh"]

0 comments on commit 6eb6479

Please sign in to comment.