Skip to content

feat(containers): Remove reliance on chained builds #908

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

Closed
Show file tree
Hide file tree
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
40 changes: 0 additions & 40 deletions 2024a/base/c9s-python-3.9/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions 2024a/base/c9s-python-3.9/requirements.txt

This file was deleted.

42 changes: 0 additions & 42 deletions 2024a/base/ubi9-python-3.9/Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions 2024a/base/ubi9-python-3.9/Pipfile

This file was deleted.

39 changes: 0 additions & 39 deletions 2024a/base/ubi9-python-3.9/Pipfile.lock

This file was deleted.

12 changes: 0 additions & 12 deletions 2024a/base/ubi9-python-3.9/requirements.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

####################
# base #
####################
FROM registry.access.redhat.com/ubi9/python-39:latest AS base

WORKDIR /opt/app-root/bin

# OS Packages needs to be installed as root
USER root

# Install usefull OS packages
RUN dnf install -y mesa-libGL && dnf clean all && rm -rf /var/cache/yum

# Other apps and tools installed as default user
USER 1001

# Install micropipenv to deploy packages from Pipfile.lock
RUN pip install --no-cache-dir -U "micropipenv[toml]"

# Install the oc client
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
-o /tmp/openshift-client-linux.tar.gz && \
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
rm -f /tmp/openshift-client-linux.tar.gz

####################
# codeserver #
####################
FROM base AS codeserver

ARG CODESERVER_SOURCE_CODE=codeserver/ubi9-python-3.9
ARG CODESERVER_VERSION=v4.22.0

LABEL name="odh-notebook-code-server-ubi9-python-3.9" \
Expand All @@ -17,16 +46,6 @@ USER 0

WORKDIR /opt/app-root/bin

# Install usefull packages from Pipfile.lock
COPY Pipfile.lock ./

# Install packages and cleanup
RUN echo "Installing softwares and packages" && \
micropipenv install && \
rm -f ./Pipfile.lock && \
# Fix permissions to support pip in Openshift environments \
chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \
fix-permissions /opt/app-root -P

# Install usefull OS packages
RUN dnf install -y jq git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
Expand All @@ -35,11 +54,7 @@ RUN dnf install -y jq git-lfs libsndfile && dnf clean all && rm -rf /var/cache/y
RUN yum install -y "https://github.com/coder/code-server/releases/download/${CODESERVER_VERSION}/code-server-${CODESERVER_VERSION/v/}-amd64.rpm" && \
yum -y clean all --enablerepo='*'

# Change ownership of relevant directories
RUN chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \
fix-permissions /opt/app-root -P

COPY --chown=1001:0 utils utils/
COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/utils utils/

# Create and intall the extensions though build-time on a temporary directory. Later this directory will copied on the `/opt/app-root/src/.local/share/code-server/extensions` via run-code-server.sh file when it starts up.
RUN mkdir -p /opt/app-root/extensions-temp && \
Expand All @@ -65,10 +80,10 @@ RUN yum install -y https://download.fedoraproject.org/pub/epel/epel-release-late
rpm -V $INSTALL_PKGS && \
yum -y clean all --enablerepo='*'

COPY --chown=1001:0 supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Copy extra files to the image.
COPY nginx/root/ /
COPY ${CODESERVER_SOURCE_CODE}/nginx/root/ /

# Changing ownership and user rights to support following use-cases:
# 1) running container on OpenShift, whose default security model
Expand Down Expand Up @@ -105,19 +120,30 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
chown -R 1001:0 /opt/app-root/src/.config/code-server

## Configure nginx
COPY nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
COPY nginx/httpconf/ /opt/app-root/etc/nginx.d/
COPY nginx/api/ /opt/app-root/api/
COPY ${CODESERVER_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
COPY ${CODESERVER_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
COPY ${CODESERVER_SOURCE_CODE}/nginx/api/ /opt/app-root/api/

# Launcher
COPY --chown=1001:0 run-code-server.sh run-nginx.sh ./
COPY --chown=1001:0 ${CODESERVER_SOURCE_CODE}/run-code-server.sh ${CODESERVER_SOURCE_CODE}/run-nginx.sh ./

ENV SHELL /bin/bash
ENV SHELL=/bin/bash

ENV PYTHONPATH=/opt/app-root/bin/python3

WORKDIR /opt/app-root/src

USER 1001


# Install usefull packages from Pipfile.lock
COPY ${CODESERVER_SOURCE_CODE}/Pipfile.lock ./

# Install packages and cleanup
RUN echo "Installing softwares and packages" && \
micropipenv install && \
rm -f ./Pipfile.lock && \
# Fix permissions to support pip in Openshift environments \
chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \
fix-permissions /opt/app-root -P

WORKDIR /opt/app-root/src
CMD ["/opt/app-root/bin/run-code-server.sh"]
Loading
Loading