Skip to content

Commit

Permalink
chore: use ubi9
Browse files Browse the repository at this point in the history
RHINENG-12543

RHINENG-12556
  • Loading branch information
psegedy authored and jdobes committed Sep 19, 2024
1 parent 158fb99 commit 7b783e5
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
docker compose -f docker-compose.test.yml exec -T test ./scripts/check_deps_versions.sh --exit-code-from
- name: Validate dashboards
run: |
docker compose -f docker-compose.test.yml exec -T test ./scripts/validate_dashboards.py ./monitoring/grafana/dashboards/ --exit-code-from
docker compose -f docker-compose.test.yml exec -T test python3.11 ./scripts/validate_dashboards.py ./monitoring/grafana/dashboards/ --exit-code-from
- name: Wait for services and upgrade DB
run: |
docker compose -f docker-compose.test.yml exec -T test python3 -m vmaas.common.wait_for_services python3 -m vmaas.reposcan.database.upgrade --exit-code-from
docker compose -f docker-compose.test.yml exec -T test python3.11 -m vmaas.common.wait_for_services python3.11 -m vmaas.reposcan.database.upgrade --exit-code-from
- name: exec common tests
run: |
docker compose -f docker-compose.test.yml exec -T test ./run_tests.sh vmaas/common --exit-code-from
Expand Down
26 changes: 10 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal

# install postgresql from COPR if not building on RHSM system (devel build)
ARG REQUIRE_RHEL="yes"
RUN RHEL_REPOS=$(microdnf repolist --enabled | grep rhel-8) ; \
if [ "$REQUIRE_RHEL" != "yes" ] && [ -z "$RHEL_REPOS" ] ; then \
curl -o /etc/yum.repos.d/mmraka-postgresql-12-epel-8.repo https://copr.fedorainfracloud.org/coprs/mmraka/postgresql-12/repo/epel-8/mmraka-postgresql-12-epel-8.repo ; \
else \
microdnf module enable postgresql:12 ; \
fi
FROM registry.access.redhat.com/ubi9/ubi-minimal

ARG VAR_RPMS=""
RUN microdnf module enable nginx:1.20 && \
microdnf install --setopt=install_weak_deps=0 --setopt=tsflags=nodocs \
RUN curl -o /etc/yum.repos.d/postgresql.repo \
https://copr.fedorainfracloud.org/coprs/mmraka/postgresql-16/repo/epel-9/mmraka-postgresql-16-epel-9.repo

RUN microdnf install -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs \
python311 python3.11-pip python3-rpm which nginx rpm-devel git-core shadow-utils diffutils systemd libicu postgresql go-toolset \
$VAR_RPMS && \
ln -s /usr/lib64/python3.6/site-packages/rpm /usr/lib64/python3.11/site-packages/rpm && \
ln -s /usr/lib64/python3.9/site-packages/rpm /usr/lib64/python3.11/site-packages/rpm && \
ln -s $(basename /usr/lib64/python3.9/site-packages/rpm/_rpm.*.so) /usr/lib64/python3.9/site-packages/rpm/_rpm.so && \
microdnf clean all

WORKDIR /vmaas
Expand All @@ -25,10 +19,10 @@ ADD poetry.lock /vmaas/
ENV LC_ALL=C.utf8
ENV LANG=C.utf8
ARG VAR_POETRY_INSTALL_OPT="--only main"
RUN pip3 install --upgrade pip && \
pip3 install --upgrade poetry~=1.5
RUN pip3.11 install --upgrade pip && \
pip3.11 install --upgrade poetry~=1.5
RUN poetry export $VAR_POETRY_INSTALL_OPT -f requirements.txt --output requirements.txt && \
pip3 install -r requirements.txt
pip3.11 install -r requirements.txt

RUN install -m 1777 -d /data && \
adduser --gid 0 -d /vmaas --no-create-home vmaas
Expand Down
2 changes: 1 addition & 1 deletion deploy/clowdapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ objects:
- sh
- -c
- >-
exec python3 -m vmaas.common.wait_for_services python3 -m vmaas.reposcan.database.upgrade
exec python3.11 -m vmaas.common.wait_for_services python3.11 -m vmaas.reposcan.database.upgrade
env:
- name: GIT_TOKEN
valueFrom:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ services:
- label=disable
command: >
bash -c 'cd /vmaas && ./scripts/check_deps_versions.sh \
&& ./scripts/validate_dashboards.py ./monitoring/grafana/dashboards/ \
&& python3 -m vmaas.common.wait_for_services python3 -m vmaas.reposcan.database.upgrade \
&& python3.11 ./scripts/validate_dashboards.py ./monitoring/grafana/dashboards/ \
&& python3.11 -m vmaas.common.wait_for_services python3.11 -m vmaas.reposcan.database.upgrade \
&& ./run_tests.sh vmaas/common \
&& ./run_tests.sh vmaas/reposcan \
&& ./run_tests.sh vmaas/webapp'
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:

vmaas_reposcan_db_init:
command: >
python3 -m vmaas.common.wait_for_services python3 -m vmaas.reposcan.database.upgrade
python3.11 -m vmaas.common.wait_for_services python3.11 -m vmaas.reposcan.database.upgrade
container_name: vmaas-reposcan-db-init
hostname: vmaas-reposcan-db-init
image: vmaas/app:latest
Expand Down
10 changes: 5 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ cd $(dirname $0)
if [[ ! -z $1 ]]; then
if [[ "$1" == "webapp" ]]; then
cd vmaas/webapp
port=$(python3 -c "import app_common_python as a;print(a.LoadedConfig.publicPort or 8000)")
port=$(python3.11 -c "import app_common_python as a;print(a.LoadedConfig.publicPort or 8000)")
[[ ! -z $QE_BUILD ]] && cmd="sleep infinity" || cmd="uvicorn --host 0.0.0.0 --port $port --no-access-log main:app"
exec python3 -m vmaas.common.wait_for_services $cmd
exec python3.11 -m vmaas.common.wait_for_services $cmd
elif [[ "$1" == "webapp-go" ]]; then
cd go/src/vmaas
exec ./main webapp
elif [[ "$1" == "reposcan" ]]; then
cd vmaas/reposcan
port=$(python3 -c "import app_common_python as a;print(a.LoadedConfig.privatePort or 8083)")
port=$(python3.11 -c "import app_common_python as a;print(a.LoadedConfig.privatePort or 8083)")
cat nginx.conf.template | sed "s/_PORT_/$port/g" > /tmp/nginx.conf
nginx -c /tmp/nginx.conf
port=$(python3 -c "import app_common_python as a;print(a.LoadedConfig.publicPort or 8000)")
exec python3 -m vmaas.common.wait_for_services uvicorn --host 0.0.0.0 --port $port --no-access-log main:app
port=$(python3.11 -c "import app_common_python as a;print(a.LoadedConfig.publicPort or 8000)")
exec python3.11 -m vmaas.common.wait_for_services uvicorn --host 0.0.0.0 --port $port --no-access-log main:app
elif [[ "$1" == "sleep" ]]; then
# "developer" mode
echo "Sleeping ..."
Expand Down
6 changes: 3 additions & 3 deletions scripts/poetry-lock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ else
fi

cat <<EOF > $workdir$dockerfile
FROM registry.access.redhat.com/ubi8/ubi-minimal
RUN microdnf install --setopt=install_weak_deps=0 --setopt=tsflags=nodocs \
FROM registry.access.redhat.com/ubi9/ubi-minimal
RUN microdnf install -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs \
python311 python3.11-pip python3.11-devel libpq-devel gcc git && \
microdnf clean all
RUN pip3 install --upgrade pip && pip3 install --upgrade poetry~=1.5
RUN pip3.11 install --upgrade pip && pip3 install --upgrade poetry~=1.5
EOF

current_dir=$(pwd)
Expand Down

0 comments on commit 7b783e5

Please sign in to comment.