Skip to content

Commit

Permalink
CRW-7636 Updating Code dockerfiles to use UBI/UBI9 (3.x Branch) (#671)
Browse files Browse the repository at this point in the history
* CRW-7636 Update Code Dockerfiles to use UBI images

* Add changes from 3.18 branch.
  • Loading branch information
SDawley authored Jan 13, 2025
1 parent cb9757e commit 54428ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
10 changes: 5 additions & 5 deletions devspaces-code/build/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ RUN npm install \
&& cp -r out/src/*.js /checode/launcher \
&& chgrp -R 0 /checode && chmod -R g+rwX /checode

# https://registry.access.redhat.com/ubi8/ubi
FROM registry.access.redhat.com/ubi8/ubi:8.10-1161 AS ubi-builder
# https://registry.access.redhat.com/ubi9
FROM registry.redhat.io/ubi9:9.5-1734495538 AS ubi-builder

RUN mkdir -p /mnt/rootfs
RUN yum install --installroot /mnt/rootfs brotli libstdc++ coreutils glibc-minimal-langpack --releasever 8 --setopt install_weak_deps=false --nodocs -y && yum --installroot /mnt/rootfs clean all
RUN yum install --installroot /mnt/rootfs brotli libstdc++ coreutils glibc-minimal-langpack --releasever 9 --setopt install_weak_deps=false --nodocs -y && yum --installroot /mnt/rootfs clean all
RUN rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.*

WORKDIR /mnt/rootfs
Expand All @@ -186,8 +186,8 @@ COPY --chmod=755 /build/remote-config /mnt/rootfs/remote/data/Machine/
#
##################################################################################################################

# https://registry.access.redhat.com/ubi8-minimal
FROM registry.access.redhat.com/ubi8-minimal:8.10-1154
# https://registry.access.redhat.com/ubi9-minimal
FROM registry.access.redhat.com/ubi9-minimal:9.5-1731593028
COPY --from=ubi-builder /mnt/rootfs/ /
ENV HOME=/home/che
USER 1001
Expand Down
27 changes: 20 additions & 7 deletions devspaces-code/build/dockerfiles/brew.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ RUN npm install \

# NOTE: can't use scatch images in OSBS, because unable to start container process: exec: \"/bin/sh\": stat /bin/sh: no such file or directory
# so we must rebuild machineexec binary in this build
# https://registry.access.redhat.com/rhel8/go-toolset
FROM registry.redhat.io/rhel8/go-toolset:1.22.9-1 as machineexec-builder
# https://registry.access.redhat.com/ubi9/go-toolset
FROM registry.redhat.io/ubi9/go-toolset:1.22.7-1733160835 as machineexec-builder
ENV GOPATH=/go/
# hadolint ignore=DL3002
USER root
Expand All @@ -442,12 +442,25 @@ RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags '-w -s' -a -instal
############################# BUILD 4: rootfs assembly ##################
#########################################################################

# https://registry.access.redhat.com/ubi8
FROM registry.redhat.io/ubi8:8.10-1161 as ubi-builder
# https://registry.access.redhat.com/ubi9
FROM registry.redhat.io/ubi9:9.5-1734495538 AS ubi-builder

RUN mkdir -p /mnt/rootfs/projects /mnt/rootfs/home/che /mnt/rootfs/remote/data/Machine/
# hadolint ignore=DL3033
RUN yum install --installroot /mnt/rootfs tar gzip brotli libstdc++ coreutils glibc-minimal-langpack --releasever 8 --setopt install_weak_deps=false --nodocs -y && yum --installroot /mnt/rootfs clean all

# Enable pulp content sets to resolve libsecret & libxkbfile as rpm
COPY $REMOTE_SOURCES/devspaces-images-code/app/devspaces-code/build/dockerfiles/content_sets_pulp.repo /etc/yum.repos.d/

RUN echo "Disabling rhel-8 based repos..." && \
dnf config-manager --set-disabled 'rhel-8*'

# hadolint ignore=DL3040,DL3041
RUN \
dnf install -y \
--enablerepo=rhel-9-for-baseos-rpms-pulp \
--enablerepo=rhel-9-for-appstream-rpms-pulp \
--installroot /mnt/rootfs tar gzip brotli libstdc++ coreutils glibc-minimal-langpack --releasever 9 --setopt install_weak_deps=false --nodocs -y && yum --installroot /mnt/rootfs clean all

RUN rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.*

WORKDIR /mnt/rootfs
Expand All @@ -474,8 +487,8 @@ RUN rm /mnt/rootfs/etc/hosts
############################# BUILD 5: minimal final image ##############
#########################################################################

# https://registry.access.redhat.com/ubi8-minimal
FROM registry.redhat.io/ubi8-minimal:8.10-1154
# https://registry.access.redhat.com/ubi9-minimal
FROM registry.redhat.io/ubi9-minimal:9.5-1731593028
COPY --from=ubi-builder /mnt/rootfs/ /
ENV HOME=/home/che
USER 1001
Expand Down

0 comments on commit 54428ab

Please sign in to comment.