-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NO-JIRA: Issue #362: feat(nbcs): build containers to be fips-ready #406
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ ARG GOLANG_VERSION=1.21 | |
|
||
# Use ubi8/go-toolset as base image | ||
FROM registry.access.redhat.com/ubi8/go-toolset:${GOLANG_VERSION} as builder | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
## Build args to be used at this step | ||
ARG SOURCE_CODE | ||
|
@@ -30,14 +32,12 @@ WORKDIR /workspace/notebook-controller | |
## Build the kf-notebook-controller | ||
USER root | ||
|
||
RUN if [ -z ${CACHITO_ENV_FILE} ]; then \ | ||
go mod download all; \ | ||
else \ | ||
source ${CACHITO_ENV_FILE}; \ | ||
fi | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -mod=mod \ | ||
-o ./bin/manager main.go | ||
# the GOARCH has not a default value to allow the binary be built according to the host where the command | ||
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO | ||
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, | ||
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. | ||
RUN if [ -z ${CACHITO_ENV_FILE} ]; then go mod download; else source ${CACHITO_ENV_FILE}; fi && \ | ||
CGO_ENABLED=1 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -tags strictfipsruntime -a -o ./bin/manager main.go | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's explained in the comment above. No default means default to the arch of the container. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, I didn't pay enough attention to the comment |
||
|
||
# Use ubi8/ubi-minimal as base image | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I think not, or not yet. These variables are there mostly when somebody wants to mess with it from the outside (do amd64 build on$m_x$ mac). When we want to do
we can do something with it.
The way kubebuilder does it is something like https://github.com/kubeflow/notebooks/blob/notebooks-v2/workspaces/controller/Makefile#L106-L115 We'd have to do this with podman instead of docker buildx, but the approach is not very different. And we'd have to take into account osbs/konflux, which (I guess) builds every arch natively and then does the manifest in a separate step.