Skip to content

Commit 198ca43

Browse files
committed
build: fix rule-evaluator x-arch dockerfile
1 parent 31a5d58 commit 198ca43

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

cmd/rule-evaluator/Dockerfile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,25 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM golang:1.24.0@sha256:2b1cbf278ce05a2a310a3d695ebb176420117a8cfcfcc4e5e68a1bef5f6354da as buildbase
15+
FROM --platform=$BUILDPLATFORM google-go.pkg.dev/golang:1.24.0@sha256:f0ed15de6a2c1d1e595b8b3dfaf2dc6af66a38c1891591c4903bd3e1b2e76518 AS buildbase
16+
ARG TARGETOS
17+
ARG TARGETARCH
1618
WORKDIR /app
1719
COPY go.mod go.mod
1820
COPY go.sum go.sum
21+
COPY vendor vendor
1922
COPY cmd cmd
2023
COPY pkg pkg
21-
COPY vendor vendor
24+
COPY internal internal
2225

23-
FROM buildbase as appbase
24-
RUN CGO_ENABLED=1 GOEXPERIMENT=boringcrypto \
25-
go build -tags boring -mod=vendor -o rule-evaluator cmd/rule-evaluator/*.go
26+
RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \
27+
apt install -y --no-install-recommends \
28+
gcc-aarch64-linux-gnu libc6-dev-arm64-cross; \
29+
CC=aarch64-linux-gnu-gcc; \
30+
fi && \
31+
GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=1 CC=${CC} \
32+
go build -tags boring -mod=vendor -o rule-evaluator cmd/rule-evaluator/*.go
2633

27-
FROM gke.gcr.io/gke-distroless/libc:gke_distroless_20240307.00_p0@sha256:4f834e207f2721977094aeec4c9daee7032c5daec2083c0be97760f4306e4f88
28-
COPY --from=appbase /app/rule-evaluator /bin/rule-evaluator
34+
FROM gcr.io/distroless/base-nossl-debian12:nonroot
35+
COPY --from=buildbase /app/rule-evaluator /bin/rule-evaluator
2936
ENTRYPOINT ["/bin/rule-evaluator"]

0 commit comments

Comments
 (0)