forked from opendatahub-io/data-science-pipelines
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review Dockerfile and RPM files for building odh-ml-pipelines-api-ser…
…ver-v2 in konflux
- Loading branch information
1 parent
4ecf3f3
commit d9f4793
Showing
1 changed file
with
34 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,48 +12,54 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM registry.redhat.io/ubi8/go-toolset@sha256:4ec05fd5b355106cc0d990021a05b71bbfb9231e4f5bdc0c5316515edf6a1c96 AS build | ||
FROM registry.redhat.io/ubi8/go-toolset@sha256:4ec05fd5b355106cc0d990021a05b71bbfb9231e4f5bdc0c5316515edf6a1c96 AS builder | ||
|
||
LABEL image="build" | ||
## Build args to be used at this step | ||
ARG SOURCE_CODE | ||
|
||
USER root | ||
WORKDIR /opt/app | ||
|
||
COPY go.mod go.sum ./ | ||
RUN dnf update -y && \ | ||
dnf install -y cmake clang openssl | ||
|
||
# Download dependencies before copying the source so they will be cached | ||
RUN go mod download | ||
|
||
COPY ${SOURCE_CODE}/go.mod ./ | ||
COPY ${SOURCE_CODE}/go.sum ./ | ||
|
||
# Copy the source | ||
COPY . ./ | ||
COPY ${SOURCE_CODE}/ ./ | ||
|
||
RUN GO111MODULE=on go build -o /bin/apiserver ./backend/src/apiserver/ && \ | ||
dnf clean all | ||
|
||
FROM registry.redhat.io/ubi8/ubi-minimal@sha256:7583ca0ea52001562bd81a961da3f75222209e6192e4e413ee226cff97dbd48c | ||
|
||
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope | ||
# don't provide "default" values (e.g. 'ARG TARGETARCH=amd64') for non-buildx environments, | ||
# see https://github.com/docker/buildx/issues/510 | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
WORKDIR /bin | ||
|
||
# Build the binaries using native go compiler from BUILDPLATFORM but compiled output for TARGETPLATFORM | ||
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/ | ||
COPY --from=builder /opt/app-root/src/backend/src/apiserver/config/ /config | ||
COPY --from=builder /bin/apiserver /bin/apiserver | ||
|
||
RUN GOOS=${TARGETOS:-linux} \ | ||
GOARCH=${TARGETARCH:-amd64} \ | ||
CGO_ENABLED=0 \ | ||
GO111MODULE=on \ | ||
go build -a -o /go/bin/server ./proxy/ | ||
RUN chmod +x /bin/apiserver | ||
|
||
USER root | ||
|
||
############################################################################### | ||
# Stage 3: Copy binaries only to create the smallest final runtime image | ||
############################################################################### | ||
FROM registry.access.redhat.com/ubi8/ubi-micro@sha256:cf8d8796a2c07577b4adc8b598aa648b200cc6b4b5f78d2e13539711ea64f275 as runtime | ||
# Adding CA certificate so API server can download pipeline through URL and wget is used for liveness/readiness probe command | ||
RUN microdnf install -y ca-certificates wget | ||
|
||
ARG USER=2000 | ||
USER 1001 | ||
|
||
USER ${USER} | ||
# Expose apiserver port | ||
EXPOSE 8888 | ||
|
||
COPY version /etc/modelmesh-version | ||
COPY --from=build /go/bin/server /go/bin/server | ||
# Start the apiserver | ||
CMD /bin/apiserver --config=/config --sampleconfig=/config/sample_config.json -logtostderr=true | ||
|
||
CMD ["/go/bin/server"] | ||
LABEL com.redhat.component="odh-ml-pipelines-api-server-v2-container" \ | ||
name="managed-open-data-hub/odh-ml-pipelines-api-server-v2-rhel8" \ | ||
description="odh-ml-pipelines-api-server-v2" \ | ||
summary="odh-ml-pipelines-api-server-v2" \ | ||
maintainer="['[email protected]']" \ | ||
io.openshift.expose-services="" \ | ||
io.k8s.display-name="odh-ml-pipelines-api-server-v2" \ | ||
io.k8s.description="odh-ml-pipelines-api-server-v2" \ | ||
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf" |