forked from cilium/tetragon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.rthooks
33 lines (30 loc) · 1.81 KB
/
Dockerfile.rthooks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# SPDX-License-Identifier: Apache-2.0
ARG GOLANG_IMAGE=docker.io/library/golang:1.22.5@sha256:829eff99a4b2abffe68f6a3847337bf6455d69d17e49ec1a97dac78834754bd6
ARG BASE_IMAGE=docker.io/library/alpine:3.20.2@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
# BUILDPLATFORM is an automatic platform ARG enabled by Docker BuildKit.
# Represents the plataform where the build is happening, do not mix with
# TARGETARCH
FROM --platform=${BUILDPLATFORM} ${GOLANG_IMAGE} AS builder
# TARGETOS is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETOS
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETARCH
WORKDIR /go/src/github.com/cilium/tetragon
RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/tetragon \
--mount=target=/root/.cache,type=cache \
--mount=target=/go/pkg/mod,type=cache \
make GOARCH=${TARGETARCH} tetragon-oci-hook tetragon-oci-hook-setup tetragon-nri-hook \
&& mkdir -p /out/${TARGETOS}/${TARGETARCH}/usr/bin \
&& mv ./contrib/tetragon-rthooks/tetragon-oci-hook /out/${TARGETOS}/${TARGETARCH}/usr/bin \
&& mv ./contrib/tetragon-rthooks/tetragon-oci-hook-setup /out/${TARGETOS}/${TARGETARCH}/usr/bin \
&& mv ./contrib/tetragon-rthooks/tetragon-nri-hook /out/${TARGETOS}/${TARGETARCH}/usr/bin
FROM ${BASE_IMAGE} AS release
# TARGETOS is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETOS
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETARCH
LABEL maintainer="[email protected]"
COPY --from=builder /out/${TARGETOS}/${TARGETARCH}/usr/bin/tetragon-oci-hook /usr/bin/
COPY --from=builder /out/${TARGETOS}/${TARGETARCH}/usr/bin/tetragon-oci-hook-setup /usr/bin/
COPY --from=builder /out/${TARGETOS}/${TARGETARCH}/usr/bin/tetragon-nri-hook /usr/bin/
WORKDIR /