Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Jul 17, 2024
1 parent 8248a2c commit 5f1fa49
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM golang:1.22-alpine3.20 AS builder
RUN go install -v -ldflags "-s -w" google.golang.org/protobuf/cmd/protoc-gen-go@latest &&\
go install -v -ldflags "-s -w" google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

COPY . /go/src/github.com/bavix/gripmock
COPY . /src

WORKDIR /go/src/github.com/bavix/gripmock/protoc-gen-gripmock
WORKDIR /src/protoc-gen-gripmock

RUN go install -v -ldflags "-s -w"

Expand All @@ -19,12 +19,17 @@ RUN apk --no-cache add git curl unzip \
&& if [ $TARGETARCH = "arm64" ]; then export DL_ARCH=aarch_64 ; fi \
&& curl -f -L -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${DL_ARCH}.zip \
&& unzip /tmp/protoc.zip && rm /tmp/protoc.zip \
&& mv bin/protoc /usr/bin && rm -rf bin \
&& mv include /usr/include &&rm -rf include &&\
&& mv bin/protoc /usr/bin && rm -rf bin include \
&& mkdir -p /usr/include \
# cloning well-known-types
&& git clone --depth=1 https://github.com/protocolbuffers/protobuf.git /protobuf-repo \
&& mv /protobuf-repo/src/ /usr/include/protobuf/ \
# cloning googleapis-types
git clone --depth=1 https://github.com/googleapis/googleapis.git /usr/include/googleapis &&\
&& git clone --depth=1 https://github.com/googleapis/googleapis.git /usr/include/googleapis \
# cleanup
find /usr/include/googleapis -not -name "*.proto" -type f -delete
&& rm -rf /protobuf-repo \
&& find /usr/include/protobuf -not -name "*.proto" -type f -delete \
&& find /usr/include/googleapis -not -name "*.proto" -type f -delete

FROM golang:1.22-alpine3.20

Expand All @@ -35,14 +40,14 @@ LABEL org.opencontainers.image.licenses=Apache-2.0
ARG version

COPY --from=protoc-builder /usr/bin/protoc /usr/bin/protoc
COPY --from=protoc-builder /usr/include/google /protobuf
COPY --from=protoc-builder /usr/include/protobuf /protobuf
COPY --from=protoc-builder /usr/include/googleapis /googleapis

COPY --from=builder $GOPATH/bin/protoc-gen-go $GOPATH/bin/protoc-gen-go
COPY --from=builder $GOPATH/bin/protoc-gen-go-grpc $GOPATH/bin/protoc-gen-go-grpc
COPY --from=builder $GOPATH/bin/protoc-gen-gripmock $GOPATH/bin/protoc-gen-gripmock

COPY . /go/src/github.com/bavix/gripmock
COPY --from=builder /src /go/src/github.com/bavix/gripmock

WORKDIR /go/src/github.com/bavix/gripmock

Expand Down

0 comments on commit 5f1fa49

Please sign in to comment.