Skip to content

Commit

Permalink
fix(blob): build the blob plugin in image
Browse files Browse the repository at this point in the history
  • Loading branch information
Yougigun committed Oct 31, 2024
1 parent ec27223 commit ce990c8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ WORKDIR /${SERVICE_NAME}
COPY plugins/grpc-proxy plugins/grpc-proxy
COPY plugins/multi-auth plugins/multi-auth
COPY plugins/registry plugins/registry
COPY plugins/blob plugins/blob
COPY plugins/sse-streaming plugins/sse-streaming

ARG TARGETARCH
Expand Down Expand Up @@ -59,6 +60,19 @@ RUN if [[ "$BUILDARCH" = "amd64" && "$TARGETARCH" = "arm64" ]] ; \
cd /${SERVICE_NAME}/plugins/registry && go mod download && \
CGO_ENABLED=1 go build -buildmode=plugin -buildvcs=false -o registry.so ./ ; fi

RUN if [[ "$BUILDARCH" = "amd64" && "$TARGETARCH" = "arm64" ]] ; \
then \
curl -sL http://musl.cc/aarch64-linux-musl-cross.tgz | \
tar zx && \
export PATH="$PATH:/${SERVICE_NAME}/aarch64-linux-musl-cross/bin" && \
cd /${SERVICE_NAME}/plugins/blob && go mod download && \
CGO_ENABLED=1 ARCH=$TARGETARCH GOARCH=$TARGETARCH GOHOSTARCH=$BUILDARCH \
CC=aarch64-linux-musl-gcc EXTRA_LDFLAGS='-extld=aarch64-linux-musl-gcc' \
go build -buildmode=plugin -buildvcs=false -o blob.so ./ ; \
else \
cd /${SERVICE_NAME}/plugins/blob && go mod download && \
CGO_ENABLED=1 go build -buildmode=plugin -buildvcs=false -o blob.so ./ ; fi

RUN if [[ "$BUILDARCH" = "amd64" && "$TARGETARCH" = "arm64" ]] ; \
then \
curl -sL http://musl.cc/aarch64-linux-musl-cross.tgz | \
Expand Down Expand Up @@ -107,6 +121,7 @@ RUN mkdir -p /usr/local/lib/krakend/plugins && chmod 777 /usr/local/lib/krakend/
COPY --from=build --chown=krakend:nogroup /${SERVICE_NAME}/plugins/grpc-proxy/grpc-proxy.so /usr/local/lib/krakend/plugins
COPY --from=build --chown=krakend:nogroup /${SERVICE_NAME}/plugins/multi-auth/multi-auth.so /usr/local/lib/krakend/plugins
COPY --from=build --chown=krakend:nogroup /${SERVICE_NAME}/plugins/registry/registry.so /usr/local/lib/krakend/plugins
COPY --from=build --chown=krakend:nogroup /${SERVICE_NAME}/plugins/blob/blob.so /usr/local/lib/krakend/plugins
COPY --from=build --chown=krakend:nogroup /${SERVICE_NAME}/plugins/sse-streaming/sse-streaming.so /usr/local/lib/krakend/plugins
COPY --from=build --chown=krakend:nogroup /go/bin/jwx /go/bin/jwx
RUN mkdir -p /instill && chmod 777 /instill
Expand Down

0 comments on commit ce990c8

Please sign in to comment.