Skip to content

Commit

Permalink
Containerize plugin for remote code generation via buf.build (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
alehechka authored Jul 30, 2022
1 parent 8773e09 commit 714c624
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM golang:1.18-alpine as go-builder

ENV GOOS=linux GOARCH=amd64 CGO_ENABLED=0

ARG VERSION="latest"

WORKDIR /app

COPY go.mod ./
COPY go.sum ./
RUN go mod download

COPY . .

RUN cd protoc-gen-graphql ; go build -ldflags "-X main.version=${VERSION}"

FROM scratch

ARG VERSION="latest"

# Runtime dependencies
LABEL "build.buf.plugins.runtime_library_versions.0.name"="google.golang.org/protobuf"
LABEL "build.buf.plugins.runtime_library_versions.0.version"="v1.28.0"
LABEL "build.buf.plugins.runtime_library_versions.1.name"="github.com/alehechka/grpc-graphql-gateway"
LABEL "build.buf.plugins.runtime_library_versions.1.version"="${VERSION}"

COPY --from=go-builder /app/protoc-gen-graphql/protoc-gen-graphql /

ENTRYPOINT [ "/protoc-gen-graphql" ]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/golang/protobuf v1.5.2
github.com/graphql-go/graphql v0.8.0
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334
github.com/iancoleman/strcase v0.2.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.0
google.golang.org/grpc v1.48.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ github.com/graphql-go/graphql v0.8.0/go.mod h1:nKiHzRM0qopJEwCITUuIsxk9PlVlwIiiI
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 h1:VHgatEHNcBFEB7inlalqfNqw65aNkM1lGX2yt3NmbS8=
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down

0 comments on commit 714c624

Please sign in to comment.