Last active
August 27, 2024 11:25
-
-
Save rizo/513849f35178d19a13adcddf2d045a19 to your computer and use it in GitHub Desktop.
Alpine (3.6) based docker image with Protocol Buffers compiler supporting Go.
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
# Protobuf Builder | |
# ================ | |
# | |
# This image builds protocol buffers library from source with Go generation | |
# support. The builder and runner images are produced. | |
# Builder Image | |
# ------------- | |
FROM golang:1.8.3-alpine3.6 as builder | |
# System setup | |
RUN apk update && apk add git curl build-base autoconf automake libtool | |
# Install protoc | |
ENV PROTOBUF_URL https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz | |
RUN curl -L -o /tmp/protobuf.tar.gz $PROTOBUF_URL | |
WORKDIR /tmp/ | |
RUN tar xvzf protobuf.tar.gz | |
WORKDIR /tmp/protobuf-3.3.0 | |
RUN mkdir /export | |
RUN ./autogen.sh && \ | |
./configure --prefix=/export && \ | |
make -j 3 && \ | |
make check && \ | |
make install | |
# Install protoc-gen-go | |
RUN go get github.com/golang/protobuf/protoc-gen-go | |
RUN cp /go/bin/protoc-gen-go /export/bin/ | |
# Export dependencies | |
RUN cp /usr/lib/libstdc++* /export/lib/ | |
RUN cp /usr/lib/libgcc_s* /export/lib/ | |
# Runner Image | |
# ------------ | |
FROM alpine:3.6 | |
RUN apk --no-cache add ca-certificates | |
RUN mkdir /import | |
WORKDIR /import | |
COPY --from=builder /export /usr | |
ENTRYPOINT ["protoc"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment