Skip to content

Commit

Permalink
Update Dockerfile.konflux
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadiIram authored Nov 14, 2024
1 parent 00ce5d6 commit 8159f18
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 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 All @@ -58,6 +55,7 @@ LABEL com.redhat.component="odh-notebook-controller-container" \
summary="odh-notebook-controller" \
maintainer="['[email protected]']" \
io.openshift.expose-services="" \
io.openshift.tags="" \
io.k8s.display-name="odh-notebook-controller" \
io.k8s.description="odh-notebook-controller" \
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"

0 comments on commit 8159f18

Please sign in to comment.