Skip to content
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

Update Dockerfile.konflux #155

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions components/notebook-controller/Dockerfile.konflux
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Build arguments
ARG SOURCE_CODE=.
ARG GOLANG_VERSION=1.21

# Use ubi8/go-toolset as base image
FROM registry.access.redhat.com/ubi8/go-toolset@sha256:bd2057262d0876188976f79d2246717994de9e03dd589b1e6471dd2b2777204f as builder
Expand All @@ -10,29 +9,26 @@ ARG TARGETARCH
## Build args to be used at this step
ARG SOURCE_CODE

#WORKDIR /workspace

WORKDIR /opt/rhods

# Copy the Go Modules manifests
COPY ${SOURCE_CODE}/notebook-controller ./notebook-controller
COPY ${SOURCE_CODE}/odh-notebook-controller ./odh-notebook-controller

WORKDIR /opt/rhods/odh-notebook-controller
# This is necessary because the Jupyter controller now depends on
# components/common
COPY ${SOURCE_CODE}/common ./common

# Update building workdir
WORKDIR /opt/rhods/notebook-controller

## Build the odh-notebook-controller
USER root

# Build
RUN CGO_ENABLED=1 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -tags strictfipsruntime -a -o ./bin/manager main.go
RUN CGO_ENABLED=1 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -tags strictfipsruntime -a -o ./bin/manager main.go

# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
#RUN cd /workspace/odh-notebook-controller && go mod download

#WORKDIR /workspace/odh-notebook-controller
# Use ubi8/ubi-minimal as base image
FROM registry.redhat.io/ubi8/ubi-minimal@sha256:c12e67af6a7e15113d76bc72f10bef2045c026c71ec8b7124c8a075458188a83

FROM registry.access.redhat.com/ubi8/ubi-minimal@sha256:7583ca0ea52001562bd81a961da3f75222209e6192e4e413ee226cff97dbd48c

## Install additional packages
RUN microdnf install -y shadow-utils &&\
Expand All @@ -44,8 +40,9 @@ RUN useradd --uid 1001 --create-home --user-group --system rhods
## Set workdir directory to user home
WORKDIR /home/rhods

## Copy odh-notebook-controller-manager binary from builder stage
COPY --from=builder /opt/rhods/odh-notebook-controller/bin/manager .
COPY --from=builder \
/opt/rhods/notebook-controller/bin/manager \
/manager

## Switch to a non-root user
USER 1001:0
Expand Down
Loading