Skip to content

Commit

Permalink
chore:update openvsx image to use more recent version (#1736) (#1752)
Browse files Browse the repository at this point in the history
Signed-off-by: Valeriy Svydenko <[email protected]>
Co-authored-by: Valeriy Svydenko <[email protected]>
  • Loading branch information
ibuziuk and svor authored Aug 9, 2023
1 parent b5b3900 commit b13fe03
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
20 changes: 9 additions & 11 deletions build/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@
#

# OpenVSX
#FROM ghcr.io/eclipse/openvsx-server:72706d1 AS openvsx-server
# fix https://github.com/eclipse/openvsx/pull/499 for https://github.com/eclipse/openvsx/issues/498
FROM ghcr.io/eclipse/openvsx-server:f061c72 AS openvsx-server
FROM ghcr.io/eclipse/openvsx-server:8fbf749 AS openvsx-server

# UBI Builder
# https://registry.access.redhat.com/ubi8/ubi
FROM registry.access.redhat.com/ubi8/ubi:8.7-1112 AS ubi-builder
RUN mkdir -p /mnt/rootfs
# Install httpd and postgresql
RUN yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
RUN yum install --installroot /mnt/rootfs postgresql14-libs postgresql14 postgresql14-server \
java-11-openjdk coreutils-single glibc-minimal-langpack glibc-langpack-en langpacks-en glibc-locale-source httpd nc \
RUN yum install --installroot /mnt/rootfs postgresql15-libs postgresql15 postgresql15-server \
java-17-openjdk coreutils-single glibc-minimal-langpack glibc-langpack-en langpacks-en glibc-locale-source httpd nc \
net-tools procps vi curl wget tar gzip jq\
--releasever 8 --nodocs -y && \
yum --installroot /mnt/rootfs clean all && \
Expand All @@ -45,7 +43,7 @@ RUN cat /mnt/rootfs/etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}:
&& cat /mnt/rootfs/etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > /mnt/rootfs/.group.template

# change permissions
RUN for f in "/mnt/rootfs/etc/passwd" "/mnt/rootfs/etc/group" "/mnt/rootfs/var/lib/pgsql" "/mnt/rootfs/usr/pgsql-14" "/mnt/rootfs/var/run/postgresql"; do\
RUN for f in "/mnt/rootfs/etc/passwd" "/mnt/rootfs/etc/group" "/mnt/rootfs/var/lib/pgsql" "/mnt/rootfs/usr/pgsql-15" "/mnt/rootfs/var/run/postgresql"; do\
chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done
Expand Down Expand Up @@ -84,24 +82,24 @@ USER postgres
ENV LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
PGDATA=/var/lib/pgsql/14/data/database \
PGDATA=/var/lib/pgsql/15/data/database \
# Use a cached version of the license list and not go over the internet
# it's needed for openvsx server when vsix is publishing on AirGap environment.
# Set Xmx to run openvsx server
JVM_ARGS="-DSPDXParser.OnlyUseLocalLicenses=true -Xmx2048m"

RUN /usr/pgsql-14/bin/initdb && \
RUN /usr/pgsql-15/bin/initdb && \
# Add all vsix files to the database
/import-vsix.sh && \
# add permissions for anyuserid
chgrp -R 0 /var/lib/pgsql/14/data/database && \
chgrp -R 0 /var/lib/pgsql/15/data/database && \
#cleanup postgresql pid
rm /var/lib/pgsql/14/data/database/postmaster.pid && \
rm /var/lib/pgsql/15/data/database/postmaster.pid && \
rm /var/run/postgresql/.s.PGSQL* && \
rm /tmp/.s.PGSQL* && \
rm /tmp/.lock && \
chmod -R 777 /tmp/file && \
chmod -R g+rwX /var/lib/pgsql/14/data/database && mv /var/lib/pgsql/14/data/database /var/lib/pgsql/14/data/old
chmod -R g+rwX /var/lib/pgsql/15/data/database && mv /var/lib/pgsql/15/data/database /var/lib/pgsql/15/data/old
ENTRYPOINT ["/entrypoint.sh"]

# append Brew metadata here
4 changes: 2 additions & 2 deletions build/dockerfiles/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function run_main() {
# start only if wanted
if [ "${START_OPENVSX}" == "true" ]; then
# change permissions
cp -r /var/lib/pgsql/14/data/old /var/lib/pgsql/14/data/database
rm -rf /var/lib/pgsql/14/data/old
cp -r /var/lib/pgsql/15/data/old /var/lib/pgsql/15/data/database
rm -rf /var/lib/pgsql/15/data/old

# start postgres and openvsx
./start-services.sh
Expand Down
10 changes: 8 additions & 2 deletions build/dockerfiles/import-vsix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ set -o pipefail
./start-services.sh

# install temporary nodejs
mkdir -p /tmp/opt/nodejs && curl -sL https://nodejs.org/download/release/v14.18.3/node-v14.18.3-linux-x64.tar.gz | tar xzf - -C /tmp/opt/nodejs --strip-components=1
mkdir -p /tmp/opt/nodejs && curl -sL https://nodejs.org/download/release/v18.16.1/node-v18.16.1-linux-x64.tar.gz | tar xzf - -C /tmp/opt/nodejs --strip-components=1
# add path
export PATH=/tmp/opt/nodejs/bin:$PATH


# install the cli
npm install -g ovsx@0.7.1
npm install -g ovsx@0.8.2

# insert user
psql -c "INSERT INTO user_data (id, login_name) VALUES (1001, 'eclipse-che');"
Expand Down Expand Up @@ -135,6 +135,12 @@ for i in $(seq 0 "$((numberOfExtensions - 1))"); do
vsixUniversalDownloadLink=$(echo "${vsixMetadata}" | jq -r '.downloads."universal"')
if [[ $vsixUniversalDownloadLink != null ]]; then
vsixDownloadLink=$vsixUniversalDownloadLink
else
# get linux download link
vsixLinuxDownloadLink=$(echo "${vsixMetadata}" | jq -r '.downloads."linux-x64"')
if [[ $vsixLinuxDownloadLink != null ]]; then
vsixDownloadLink=$vsixLinuxDownloadLink
fi
fi
fi

Expand Down
4 changes: 2 additions & 2 deletions build/dockerfiles/start-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ set -o pipefail

# start postgresql
pushd /var/lib/pgsql || return
/usr/pgsql-14/bin/postgres &
/usr/pgsql-15/bin/postgres &
# wait that postgresql is ready
printf "Waiting that postgresql is ready"
timeout 0 bash -c "until /usr/pgsql-14/bin/pg_isready -h 127.0.0.1 -p 5432 -U postgres -q; do printf '.'; sleep 1; done"
timeout 0 bash -c "until /usr/pgsql-15/bin/pg_isready -h 127.0.0.1 -p 5432 -U postgres -q; do printf '.'; sleep 1; done"
echo "Database is ready"

# start openvsx
Expand Down

0 comments on commit b13fe03

Please sign in to comment.