forked from opendatahub-io/ai-gateway-payload-processing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.e2e
More file actions
57 lines (44 loc) · 1.83 KB
/
Copy pathDockerfile.e2e
File metadata and controls
57 lines (44 loc) · 1.83 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Dockerfile.e2e builds a container image for running E2E tests.
# Used by the RHOAI shift-left Jenkins pipeline via `podman run`.
#
# Usage:
# podman run --rm \
# -v /path/to/kubeconfig:/kubeconfig:ro \
# -e KUBECONFIG=/kubeconfig \
# -e E2E_LABEL_FILTER=smoke \
# -v $(pwd)/results:/results \
# quay.io/opendatahub/ai-gateway-payload-processing-e2e:latest
ARG GOLANG_VERSION=1.25
## Stage 1: Build the test binary and download kubectl
FROM registry.access.redhat.com/ubi9/go-toolset:$GOLANG_VERSION AS builder
ARG OCP_VERSION=4.21.15
ARG CGO_ENABLED=1
ARG TARGETOS=linux
ARG TARGETARCH=amd64
USER root
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ cmd/
COPY pkg/ pkg/
COPY test/ test/
# Compile the Ginkgo test binary with CGO and strict FIPS runtime (matches Dockerfile pattern).
RUN CGO_ENABLED=${CGO_ENABLED} GOEXPERIMENT=strictfipsruntime GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go test -c -o /e2e-tests.test ./test/e2e/ \
-ldflags="-s -w"
# Download FIPS-compliant kubectl from the OpenShift client tarball (rhel9, CGO+OpenSSL).
RUN curl -sL "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/${OCP_VERSION}/openshift-client-linux-${TARGETARCH}-rhel9-${OCP_VERSION}.tar.gz" | \
tar -xz -C /tmp/ oc kubectl && \
mv /tmp/kubectl /usr/local/bin/kubectl && \
chmod +x /usr/local/bin/kubectl
## Stage 2: Runtime
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.8@sha256:463cae32c6f6f5594b11a5c22de275016bd8545ce58a6373388e8b24f13fc15c
WORKDIR /e2e
COPY --from=builder /e2e-tests.test /e2e/e2e-tests.test
COPY --from=builder /usr/local/bin/kubectl /usr/local/bin/kubectl
COPY test/e2e/scripts/entrypoint.sh /e2e/entrypoint.sh
COPY config/crd/bases/ /e2e/crds/
RUN chmod +x /e2e/entrypoint.sh /e2e/e2e-tests.test && \
mkdir -p /results
USER 1001
ENTRYPOINT ["/e2e/entrypoint.sh"]