From b5131277e977ce7e894ac116421bce1cb2f2cfca Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 17 Dec 2024 14:31:03 +0300 Subject: [PATCH 1/5] Use base ubi9 image --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 03b94ce7..77ae7848 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,15 +38,13 @@ RUN mkdir /backend \ && cp -r /build/app /backend/ \ && cp -r /build/res /backend/ -FROM registry.access.redhat.com/ubi9/python-311:latest +FROM registry.access.redhat.com/ubi9:latest USER root WORKDIR /backend/ COPY --from=builder /backend ./ COPY --from=builder /venv /venv COPY --from=builder /usr/share/nltk_data /usr/share/nltk_data/ -RUN dnf -y upgrade && dnf -y install pcre-devel \ - && dnf -y remove emacs-filesystem libjpeg-turbo libtiff libpng wget \ - && dnf -y autoremove \ +RUN dnf -y upgrade && dnf -y install python3.11 ca-certificates pcre-devel \ && dnf clean all \ && pip install --upgrade pip \ && pip install --upgrade setuptools \ From dac511d3fe3e2f194ae859d0ef5de20eab9c8f8b Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 17 Dec 2024 14:37:57 +0300 Subject: [PATCH 2/5] Use base ubi9 image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 77ae7848..0a64e040 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ WORKDIR /backend/ COPY --from=builder /backend ./ COPY --from=builder /venv /venv COPY --from=builder /usr/share/nltk_data /usr/share/nltk_data/ -RUN dnf -y upgrade && dnf -y install python3.11 ca-certificates pcre-devel \ +RUN dnf -y upgrade && dnf -y install python3.11 python3.11-pip ca-certificates pcre-devel \ && dnf clean all \ && pip install --upgrade pip \ && pip install --upgrade setuptools \ From d0af458693bceb0cb4d1f544b1814e8207aed3ff Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 17 Dec 2024 18:27:21 +0300 Subject: [PATCH 3/5] Use base ubi9 image --- Dockerfile | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0a64e040..1df245c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,22 +44,29 @@ WORKDIR /backend/ COPY --from=builder /backend ./ COPY --from=builder /venv /venv COPY --from=builder /usr/share/nltk_data /usr/share/nltk_data/ + +ENV VIRTUAL_ENV="/venv" +# uWSGI configuration (customize as needed): +ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" PYTHONPATH=/backend \ + FLASK_APP=app/main.py UWSGI_WSGI_FILE=app/main.py UWSGI_SOCKET=:3031 UWSGI_HTTP=:5001 \ + UWSGI_VIRTUALENV=${VIRTUAL_ENV} UWSGI_MASTER=1 UWSGI_WORKERS=4 UWSGI_THREADS=8 UWSGI_MAX_FD=10000 \ + UWSGI_LAZY_APPS=1 UWSGI_WSGI_ENV_BEHAVIOR=holy PYTHONDONTWRITEBYTECODE=1 + RUN dnf -y upgrade && dnf -y install python3.11 python3.11-pip ca-certificates pcre-devel \ && dnf clean all \ - && pip install --upgrade pip \ - && pip install --upgrade setuptools \ - && mkdir -p -m 0700 /backend/storage \ && groupadd uwsgi && useradd -g uwsgi uwsgi \ - && chown -R uwsgi: /usr/share/nltk_data \ - && chown -R uwsgi: /backend + && chown -R uwsgi:uwsgi ${VIRTUAL_ENV} \ + && chown -R uwsgi:uwsgi /usr/share/nltk_data \ + && chown -R uwsgi:uwsgi /backend + USER uwsgi EXPOSE 5001 -ENV VIRTUAL_ENV="/venv" -# uWSGI configuration (customize as needed): -ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" PYTHONPATH=/backend \ - FLASK_APP=app/main.py UWSGI_WSGI_FILE=app/main.py UWSGI_SOCKET=:3031 UWSGI_HTTP=:5001 \ - UWSGI_VIRTUALENV=${VIRTUAL_ENV} UWSGI_MASTER=1 UWSGI_WORKERS=4 UWSGI_THREADS=8 UWSGI_MAX_FD=10000 UWSGI_LAZY_APPS=1 \ - UWSGI_WSGI_ENV_BEHAVIOR=holy PYTHONDONTWRITEBYTECODE=1 + +RUN mkdir -p -m 0644 /backend/storage \ + && source "${VIRTUAL_ENV}/bin/activate" \ + && pip install --upgrade pip \ + && pip install --upgrade setuptools + # Start uWSGI CMD ["/venv/bin/uwsgi", "--http-auto-chunked", "--http-keepalive"] HEALTHCHECK --interval=1m --timeout=5s --retries=2 CMD ["curl", "-s", "-f", "--show-error", "http://localhost:5001/"] From ec9480a2b74aca7b787657b509267b5e7231ceac Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 19 Dec 2024 10:31:51 +0300 Subject: [PATCH 4/5] Update version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 26f30f79..9f7a8aa9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.13.0 +5.13.1 From e9b47f8e4b2231eb542785e57a928b38feccf133 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 19 Dec 2024 10:36:56 +0300 Subject: [PATCH 5/5] Revert "Update version" This reverts commit ec9480a2b74aca7b787657b509267b5e7231ceac. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9f7a8aa9..26f30f79 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.13.1 +5.13.0