|
30 | 30 | # * asset-ide-packaging.tar.gz - IDE packaging downloaded previously;
|
31 | 31 | # * asset-projector-server-assembly.zip - Projector Server assembly;
|
32 | 32 | # * asset-static-assembly.tar.gz - archived `static/` directory.
|
33 |
| -# https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/ubi8-minimal |
34 |
| -FROM registry.access.redhat.com/ubi8-minimal:8.5-218 as projectorAssembly |
35 |
| -ENV PROJECTOR_ASSEMBLY_DIR /projector |
36 |
| -COPY asset-ide-packaging.tar.gz /tmp/ide-unpacked/ |
37 |
| -COPY asset-projector-server-assembly.zip $PROJECTOR_ASSEMBLY_DIR/ |
38 |
| -COPY asset-static-assembly.tar.gz $PROJECTOR_ASSEMBLY_DIR/ |
39 |
| -RUN set -ex \ |
40 |
| - && microdnf install -y --nodocs findutils tar gzip unzip \ |
41 |
| - && cd /tmp/ide-unpacked \ |
42 |
| - && tar xf asset-ide-packaging.tar.gz \ |
43 |
| - && rm asset-ide-packaging.tar.gz \ |
44 |
| - && find . -maxdepth 1 -type d -name * -exec mv {} $PROJECTOR_ASSEMBLY_DIR/ide \; \ |
45 |
| - && cd $PROJECTOR_ASSEMBLY_DIR \ |
46 |
| - && rm -rf /tmp/ide-unpacked \ |
47 |
| - && unzip asset-projector-server-assembly.zip \ |
48 |
| - && rm asset-projector-server-assembly.zip \ |
49 |
| - && find . -maxdepth 1 -type d -name projector-server-* -exec mv {} projector-server \; \ |
50 |
| - && mv projector-server ide/projector-server \ |
51 |
| - && chmod 644 ide/projector-server/lib/* \ |
52 |
| - && tar -xf asset-static-assembly.tar.gz \ |
53 |
| - && rm asset-static-assembly.tar.gz \ |
54 |
| - && mv static/* . \ |
55 |
| - && rm -rf static \ |
56 |
| - && mv ide-projector-launcher.sh ide/bin \ |
57 |
| - && find . -exec chgrp 0 {} \; -exec chmod g+rwX {} \; \ |
58 |
| - && find . -name "*.sh" -exec chmod +x {} \; \ |
59 |
| - && mv projector-user/.config .default \ |
60 |
| - && rm -rf projector-user |
| 33 | +# https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/ubi8 |
| 34 | +FROM registry.access.redhat.com/ubi8/ubi:8.5-214 as ubi-builder |
| 35 | +RUN mkdir -p /mnt/rootfs |
| 36 | +RUN yum install unzip -y --nodocs && \ |
| 37 | + if [[ $(uname -m) == "s390x" ]]; then LIBSECRET="\ |
| 38 | + https://rpmfind.net/linux/fedora-secondary/releases/34/Everything/s390x/os/Packages/l/libsecret-0.20.4-2.fc34.s390x.rpm \ |
| 39 | + https://rpmfind.net/linux/fedora-secondary/releases/34/Everything/s390x/os/Packages/l/libsecret-devel-0.20.4-2.fc34.s390x.rpm \ |
| 40 | + glib2-devel pcre-cpp pcre-devel pcre-utf16 pcre-utf32"; \ |
| 41 | + elif [[ $(uname -m) == "ppc64le" ]]; then LIBSECRET="\ |
| 42 | + https://rpmfind.net/linux/centos/8-stream/BaseOS/ppc64le/os/Packages/libsecret-devel-0.18.6-1.el8.ppc64le.rpm \ |
| 43 | + libsecret"; \ |
| 44 | + elif [[ $(uname -m) == "x86_64" ]]; then LIBSECRET="\ |
| 45 | + https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/libsecret-devel-0.18.6-1.el8.x86_64.rpm \ |
| 46 | + libsecret"; \ |
| 47 | + fi && \ |
| 48 | + yum install --installroot /mnt/rootfs \ |
| 49 | + brotli libstdc++ coreutils glibc-minimal-langpack \ |
| 50 | + jq shadow-utils wget git nss procps findutils which socat \ |
| 51 | + java-11-openjdk-devel \ |
| 52 | + python2 python39 \ |
| 53 | + libXext libXrender libXtst libXi \ |
| 54 | + $LIBSECRET \ |
| 55 | + --releasever 8 --setopt install_weak_deps=false --nodocs -y && \ |
| 56 | + yum --installroot /mnt/rootfs clean all |
| 57 | +RUN rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* |
| 58 | + |
| 59 | +RUN mkdir -p /mnt/rootfs/projects && mkdir -p /mnt/rootfs/home/projector && mkdir -p /mnt/rootfs/projector && \ |
| 60 | + cat /mnt/rootfs/etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/bash#g > /mnt/rootfs/home/projector/.passwd.template && \ |
| 61 | + cat /mnt/rootfs/etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > /mnt/rootfs/home/projector/.group.template |
| 62 | + |
| 63 | +WORKDIR /mnt/rootfs/projector |
| 64 | + |
| 65 | +COPY --chown=0:0 asset-ide-packaging.tar.gz . |
| 66 | +RUN tar -xf asset-ide-packaging.tar.gz && rm asset-ide-packaging.tar.gz && \ |
| 67 | + find . -maxdepth 1 -type d -name * -exec mv {} ide \; |
| 68 | + |
| 69 | +COPY --chown=0:0 asset-projector-server-assembly.zip . |
| 70 | +RUN unzip asset-projector-server-assembly.zip && rm asset-projector-server-assembly.zip && \ |
| 71 | + find . -maxdepth 1 -type d -name projector-server-* -exec mv {} ide/projector-server \; |
61 | 72 |
|
62 |
| -# Stage 2. Build the main image with necessary environment for running Projector |
63 |
| -# Doesn't require to be a desktop environment. Projector runs in headless mode. |
| 73 | +COPY --chown=0:0 asset-static-assembly.tar.gz . |
| 74 | +RUN tar -xf asset-static-assembly.tar.gz && rm asset-static-assembly.tar.gz && \ |
| 75 | + chown -R 0:0 static && \ |
| 76 | + mv static/* . && rm -rf static && \ |
| 77 | + chmod +x *.sh && \ |
| 78 | + mv ide-projector-launcher.sh ide/bin && \ |
| 79 | + mv config ide/ |
| 80 | + |
| 81 | +RUN for f in "/mnt/rootfs/bin/" "/mnt/rootfs/home/projector" "/mnt/rootfs/etc/passwd" "/mnt/rootfs/etc/group" "/mnt/rootfs/projects" "/mnt/rootfs/projector/ide/bin" ; do\ |
| 82 | + chgrp -R 0 ${f} && \ |
| 83 | + chmod -R g+rwX ${f}; \ |
| 84 | + done |
| 85 | + |
| 86 | + |
| 87 | +# Stage 2. Copy from build environment Projector assembly to the runtime. Projector runs in headless mode. |
64 | 88 | # https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/ubi8-minimal
|
65 | 89 | FROM registry.access.redhat.com/ubi8-minimal:8.5-218
|
66 |
| -ENV USER projector |
67 |
| -ENV HOME /home/$USER |
| 90 | +ENV HOME=/home/projector |
68 | 91 | ENV PROJECTOR_ASSEMBLY_DIR /projector
|
69 |
| -ENV PROJECTOR_CONFIG_DIR $HOME/.config |
70 |
| -COPY install-platform-dependencies.sh /tmp |
71 |
| -RUN set -ex \ |
72 |
| - && microdnf install -y --nodocs \ |
73 |
| - jq shadow-utils wget git nss procps findutils which socat \ |
74 |
| - # Java 11 support |
75 |
| - java-11-openjdk-devel \ |
76 |
| - # Python support |
77 |
| - python2 python39 \ |
78 |
| - # Packages needed for AWT. |
79 |
| - libXext libXrender libXtst libXi \ |
80 |
| - # Arch specific installs of libsecret and libsecret-devel (required by JetBrains products) |
81 |
| - && chmod +x /tmp/install-platform-dependencies.sh && /tmp/install-platform-dependencies.sh && rm -f /tmp/install-platform-dependencies.sh \ |
82 |
| - # create user configuration |
83 |
| - && adduser -r -u 1002 -G root -d $HOME -m -s /bin/sh $USER \ |
84 |
| - && echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ |
85 |
| - && mkdir /projects \ |
86 |
| - && for f in "${HOME}" "/etc/passwd" "/etc/group /projects"; do\ |
87 |
| - chgrp -R 0 ${f} && \ |
88 |
| - chmod -R g+rwX ${f}; \ |
89 |
| - done \ |
90 |
| - && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/bash#g > ${HOME}/passwd.template \ |
91 |
| - && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ |
92 |
| - # Change permissions to allow editing of files for openshift user |
93 |
| - && find $HOME -exec chgrp 0 {} \; -exec chmod g+rwX {} \; |
94 |
| - |
95 |
| -COPY --chown=$USER:root --from=projectorAssembly $PROJECTOR_ASSEMBLY_DIR $PROJECTOR_ASSEMBLY_DIR |
96 |
| - |
97 |
| -USER $USER |
98 |
| -WORKDIR /projects |
| 92 | +ENV PROJECTOR_CONFIG_DIR $HOME/.jetbrains |
| 93 | +COPY --from=ubi-builder /mnt/rootfs/ / |
| 94 | +USER 1001 |
99 | 95 | EXPOSE 8887
|
100 | 96 | ENTRYPOINT $PROJECTOR_ASSEMBLY_DIR/entrypoint.sh
|
0 commit comments